[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: BASH_SUBSHELL reset to 0 on EXIT trap in aubshell
From: |
Chet Ramey |
Subject: |
Re: BASH_SUBSHELL reset to 0 on EXIT trap in aubshell |
Date: |
Sat, 15 Oct 2016 20:26:12 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
On 10/13/16 4:00 AM, Martijn Dekker wrote:
> bash resets BASH_SUBSHELL to 0 when executing an EXIT trap, even if the
> EXIT trap is executed in a subshell.
>
> echo $(trap 'echo $BASH_SUBSHELL' EXIT; echo $BASH_SUBSHELL)
> Actual output: 1 0
> Expected output: 1 1
This is a reasonable suggestion for both command and process substitution.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/