[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EXIT trap definition order

From: Grisha Levit
Subject: Re: EXIT trap definition order
Date: Mon, 20 Mar 2023 11:02:07 -0400

On Mon, Mar 20, 2023 at 10:57 AM Chet Ramey <chet.ramey@case.edu> wrote:
> On 3/17/23 1:28 PM, Grisha Levit wrote:
> > It seems that if a trap handler for a terminating signal resends its
> > own signal (after resetting the signal disposition), any configured
> > EXIT trap will be executed (as I think is expected), but only if an
> > EXIT trap had already been set prior to the the first instance of a
> > trap having been set for the terminating signal in question.
> If the shell is handling a terminating signal and receives another instance
> of that signal while doing so, it takes that as an indication to exit
> immediately.

Thanks, that makes sense. But then the first script should _not_ print
EXIT, right?

i.e. if both TERM and EXIT traps are defined, it shouldn't matter
which one happened to be defined first.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]