pipefail
pipefail 选项,不起眼,却很重要
set -o pipefail 是一个在 Bash shell 脚本中常用的命令,它的作用是改变管道命令的退出状态。 在默认情况下,一个管道命令(由多个命令通过管道符 | 连接而成的命令)的退出状态是最后一个命令的退出状态,而不考虑前面的命令是否执行成功。 例如,下面的命令: command1 | ......
set -o pipefail
set -o pipefail causes a pipeline (for example, curl -s https://sipb.mit.edu/ | grep foo ) to produce a failure return code if any command errors. Nor ......