Bash 脚本中的 set -o pipefail 是什么意思?

What is the meaning of set -o pipefail in Bash Script?

shell 脚本开头的 set -o pipefail 是什么意思?

man bash

pipefail

If set, the return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands in the pipeline exit successfully. This option is disabled by default.

“管道”在哪里

command1 | command2 | command3

没有pipefail,管道的return值为最后一个命令的退出状态。