我知道管道会创建子外壳。
我测试$BASH_SUBSHELL
and $BASHPID
,发现$BASH_SUBSHELL
管道没有增加
echo $BASH_SUBSHELL # 0
echo $BASHPID # 8347
echo $BASH_SUBSHELL | cat # 0
echo $BASHPID | cat # 9727
(echo $BASH_SUBSHELL) # 1
(echo $BASHPID) # 9778