Nesting Level of Subshells

$BASH_SUBSHELL is the nesting level of subshell or subshell environments.

Examples

Print subshell nesting :

1
echo "$BASH_SUBSHELL $(echo -n "$BASH_SUBSHELL $(echo -n $BASH_SUBSHELL)")"

Output: 0 1 2

BashSupport Pro is a Bash IDE with support for $BASH_SUBSHELL – try it now!
© 2020–2022 Joachim Ansorg
Imprint
Privacy Policy
Legal