Bash# Shell变量 PIPESTATUS
在调查ranger为什么不能正确判断mimetype的时候,发现scope.sh里用到一个我没见过的变量PIPESTATUS,所以这里稍微总结下。
Bash里的帮助是这样说的
An array variable containing a list of exit status values from the processes in the most-recently-executed foreground pipeline (which may contain only a single command).
一个随便的例子
>>> echo abc | grep "a" | grep "d" | echo 23
23>>> echo ${PIPESTATUS[*]}
0 0 1 0