$cat exit.sh
testvcf=$1 if [ ! -f $testvcf ];then echo "testvcf nonexist :$testvcf" exit 0 fi echo "run successful"
$ cat run_Exit.sh
sh exit.sh 3err sh exit.sh 2err sh exit.sh 4err
結果
有的shell 在運行時候發現文件丟失,想先把存在的文件跑了,就適用
先判斷哪些文件在,在接着運行,還不會報錯,影響其他任務