Shell pipe: Exit immediately when one command fails

前端 未结 5 1012
长发绾君心
长发绾君心 2020-12-28 15:09

I\'m using a pipe of several commands in bash. Is there a way of configuring bash to terminate all commands in the whole pipeline immediately should one of the commands fail

5条回答
  •  佛祖请我去吃肉
    2020-12-28 15:29

    sleep 5 doesn't produce any output until it finishes, while find / immediately produces output that bash attempts to pipe to false.

提交回复
热议问题