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. Normally, pipelines only return a failure if the last command errors. In combination with set -e , this will make your script exit if any command in a pipeline errors.

 

 

posted @ 2023-05-05 09:53  yinhuachen  阅读(27)  评论(0编辑  收藏  举报