以下簡單的代碼允許:
file不存在在./文件夾的情況下,運行某代碼;
file存在的情況下,跳過某代碼。
step=$(ls -1 ./|grep "file")
if [[ -z "${step}" ]]; then
printf "\t run whatever this is\n"
else
printf "\t skip step\n"
fi
以下簡單的代碼允許:
file不存在在./文件夾的情況下,運行某代碼;
file存在的情況下,跳過某代碼。
step=$(ls -1 ./|grep "file")
if [[ -z "${step}" ]]; then
printf "\t run whatever this is\n"
else
printf "\t skip step\n"
fi