Incremented by one each time a subshell or subshell
environment
is spawned. The initial value is 0.
This suggests that:
echo $BASH_SUBSHELL ; ( echo ) ; echo $BASH_SUBSHELL
would not give the same answer for BASH_SUBSHELL
No, it suggests that:
echo $BASH_SUBSHELL ; ( echo $BASH_SUBSHELL )
would not give the same answer for BASH_SUBSHELL
In your example, the second "echo $BASH_SUBSHELL" is at the same
depth as the first.
--
Chris F.A. Johnson, <http://cfajohnson.com/>
Author:
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)