Re: [Help-bash] Why BASH_SUBSHELL behaves differently in () and <()?
From:
Greg Wooledge
Subject:
Re: [Help-bash] Why BASH_SUBSHELL behaves differently in () and <()?
Date:
Thu, 17 Sep 2015 09:57:39 -0400
User-agent:
Mutt/1.4.2.3i
On Thu, Sep 17, 2015 at 09:20:19AM +0000, ziyunfei wrote:
> Chet, `echo $BASH_SUBSHELL &' and `: | echo $BASH_SUBSHELL' still print 0
> in bash-4.4 alpha, is this a problem?
The expansion is being done in the parent shell, rather than the subshell.
imadev:~$ echo "$BASH_SUBSHELL" &
0
[1] 16799
[1] Done echo "$BASH_SUBSHELL"
imadev:~$ { echo "$BASH_SUBSHELL"; } &
1
[1] 16800
[1] Done { echo "$BASH_SUBSHELL"; }