我使用以下脚本来查看文件是否存在:
#!/bin/bash
FILE=$1
if [ -f $FILE ]; then
echo "File $FILE exists."
else
echo "File $FILE does not exist."
fi
Run Code Online (Sandbox Code Playgroud)
如果我只想检查文件是否不存在,使用的语法是什么?
#!/bin/bash
FILE=$1
if [ $FILE does not exist ]; then
echo "File $FILE does not exist."
fi
Run Code Online (Sandbox Code Playgroud)