bug-bash
[Top][All Lists]
Advanced

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

Re: return exit code in EXIT trap


From: Chet Ramey
Subject: Re: return exit code in EXIT trap
Date: Mon, 8 Aug 2022 10:14:20 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

On 8/6/22 2:44 PM, Robert Elz wrote:

It is possible (and seems so, from messages in this thread) that bash allows
a return in the trap string (not in a function called in that string) if the
trap occurs while executing a function (then the return applies to that
function).

Every shell allows this. Since the trap `action' is processed as if it were
invoked as `eval action', a return directly in it -- and not in a shell
function that `action' executes -- applies to a function that was executing
when the trap was executed.


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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