Answers
$ set -e
这行代码之后的任何代码,如果返回一个非0的值,那么整个脚本立即退出,官方的说明是为了防止错误出现滚雪球的现象
$ set -o 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.
可理解为:
告诉 bash 返回从右到左第一个以非0状态退出的管道命令的返回值,如果所有命令都成功执行时才返回0
专业loli控
answered 11 years, 5 months ago