$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 在运行时候发现文件丢失,想先把存在的文件跑了,就适用
先判断哪些文件在,在接着运行,还不会报错,影响其他任务