[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-bash] Why BASH_SUBSHELL behaves differently in () and <()?
From: |
Peng Yu |
Subject: |
[Help-bash] Why BASH_SUBSHELL behaves differently in () and <()? |
Date: |
Sat, 4 Apr 2015 18:24:11 -0500 |
Hi,
The following code shows that BASH_SUBSHELL behaves differently in ()
and <(). But my understanding is that, in both case, the echo commands
are run in a subshell. Is it so? If so, 1 instead of 0 should be
printed in the last command?
~$ cat main.sh
#!/usr/bin/env bash
echo xxx "$BASH_SUBSHELL"
(
echo yyy "$BASH_SUBSHELL"
)
cat <(echo zzz "$BASH_SUBSHELL" >&2)
~$ ./main.sh
xxx 0
yyy 1
zzz 0
--
Regards,
Peng
- [Help-bash] Why BASH_SUBSHELL behaves differently in () and <()?,
Peng Yu <=