$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 在運行時候發現文件丟失,想先把存在的文件跑了,就適用
先判斷哪些文件在,在接着運行,還不會報錯,影響其他任務
$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 在運行時候發現文件丟失,想先把存在的文件跑了,就適用
先判斷哪些文件在,在接着運行,還不會報錯,影響其他任務
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。