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:
Mon, 6 Apr 2015 08:15:00 -0400
User-agent:
Mutt/1.4.2.3i
On Sat, Apr 04, 2015 at 06:24:11PM -0500, Peng Yu wrote:
> cat <(echo zzz "$BASH_SUBSHELL" >&2)
>
> zzz 0
It's not entirely clear to me how BASH_SUBSHELL works. It doesn't
seem to catch the implicit subshells created by pipelines, either:
imadev:~$ echo "$BASH_SUBSHELL"|cat
0
Maybe it only counts explicit "(...)" subshells? It's odd, because
BASHPID seems to work:
imadev:~$ echo $BASHPID
20401
imadev:~$ echo $BASHPID | cat
7881
imadev:~$ cat <(echo "$BASHPID")
7883