bash - why $BASH_SUBSHELL doesn't increase in pipe -


i know pipe create subshell.

i test $bash_subshell , $bashpid , , find $bash_subshell doesn't increase in pipe

echo $bash_subshell         # 0 echo $bashpid               # 8347  echo $bash_subshell | cat   # 0 echo $bashpid | cat         # 9727  (echo $bash_subshell)       # 1 (echo $bashpid)             # 9778 

when bash merely forks, sets command , execves it, doesn't count subshell.

for kind of control structure, command groups, if statements , while loops, shell has involved beyond setup, does.

this apparent bash source, execute_command_internal in execute_cmd.c.


Comments

Popular posts from this blog

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -

python - How to create a legend for 3D bar in matplotlib? -