千家信息网

shell 判断文件

发表于:2025-02-11 作者:千家信息网编辑
千家信息网最后更新 2025年02月11日,yuan_file="/home/coservice.war"if [ ! -f "$yuan_file" ]thenecho "【文件检测fail】$yuan_file不存在,$0退出执行"exit
千家信息网最后更新 2025年02月11日shell 判断文件

yuan_file="/home/coservice.war"

if [ ! -f "$yuan_file" ]

then

echo "【文件检测fail】$yuan_file不存在,$0退出执行"

exit 1

else

echo "【文件检测ok】$yuan_file存在,$0继续执行"

fi


0