停在第一个错误 [英] Stop on first error
本文介绍了停在第一个错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:结果
<一href=\"http://stackoverflow.com/questions/2870992/automatic-exit-from-bash-shell-script-on-error\">Automatic从错误的bash shell脚本退出
块引用>我怎么能对第一个命令失败的bash停止,没有把这样的东西都是通过我的code?
some_prog || 1号出口
some_other_prog || 1号出口
解决方案也许你想
设置-e
:<一个href=\"http://www.davidpashley.com/articles/writing-robust-shell-scripts.html#id2382181\">http://www.davidpashley.com/articles/writing-robust-shell-scripts.html#id2382181
Possible Duplicate:
Automatic exit from bash shell script on errorHow can I have bash stop on the first command failure, without putting stuff like this all through my code?
some_prog || exit 1 some_other_prog || exit 1
解决方案Maybe you want
set -e
:http://www.davidpashley.com/articles/writing-robust-shell-scripts.html#id2382181
这篇关于停在第一个错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文