On 12/29/09 4:19 AM, Akim Demaille wrote:
> Hi!
> 
> On the following script, the local variable $name of bar() hides the
> global $name when entering the trap.  I have observed that with several
> versions of Bash, including
> 
>> GNU bash, version 4.0.33(1)-release (i486-pc-linux-gnu)

I believe that bash is correct.  When the `exit' builtin is invoked, and
the trap is executed, the shell is still executing in the function's
context.  There was no `return', and running exit or a trap does not
implicitly call it.

> FWIW, Zsh and Dash behave as I expected.

FWIW, ksh93 behaves like bash.

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


Reply via email to