Spi*_*idE 8 error-handling bash shell python-2.7
我在shell脚本中调用python脚本.如果失败,python脚本将返回错误代码.
如何在shell脚本中处理这些错误代码并在必要时退出?
ani*_*ane 15
最后一个命令的退出代码包含在$?
.
使用以下伪代码:
python myPythonScript.py
ret=$?
if [ $ret -ne 0 ]; then
#Handle failure
#exit if required
fi
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
20067 次 |
最近记录: |