[英]Error capture of perl script in shell
我试图捕获perl脚本的实际错误(如果失败)。 并且它没有停止,并且下一个脚本被触发。
更新的 Python脚本运行良好,仅对perl脚本有问题
if ! perl test.pl arg2 arg1 ;
then
echo "Error running test.pl in Preparing data for algorithm; rest of process stopped." >&2 >>$LOG_PATH/Perl_RUN_$TRACK_TIME
elif ! python themes.py;
then
echo "Error running themes.py rest of process stopped." >&2 >>$LOG_PATH/Python_RUN_$feed_name'_'$TRACK_TIME
elif ! python $SCRIPT_PATH/pre_survey_dt.py;
then
echo "Error running pre_survey_dt.py rest of process stopped." >&2 >>$LOG_PATH/Python_RUN_$TRACK_TIME
fi
请告知我这里缺少的内容。
if ! perl test.pl arg2 arg1; then
echo "test.pl failed with error code $?" >&2
exit 1
fi
使用return
而不是exit
:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.