shell-script - 这个 shell 为啥会报错
本文介绍了shell-script - 这个 shell 为啥会报错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
ls -rlt 'file_name_not_exits.txt'
echo "$?" && if [ "$?" == "1" ]; then echo "错误存在" fi
syntax error: unexpected end of file
解决方案
换成这样吧?
ls -rlt 'file_name_not_exits.txt'
res=$?
echo "$res" && if [ "$res" == "1" ]; then echo "错误存在"; fi
这篇关于shell-script - 这个 shell 为啥会报错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文