Shell判断上次命令执行失败时退出 if [ $? != 0 ]; then echo "err" exit 0 fi 返回错误使用exit 1 参考: https://zhidao.baidu.com/question/584426878.html