I've used the following script to see if a file exists:
(我使用以下脚本查看文件是否存在:)
#!/bin/bash
FILE=$1
if [ -f $FILE ]; then
echo "File $FILE exists."
else
echo "File $FILE does not exist."
fi
What's the correct syntax to use if I only want to check if the file does not exist?
(如果我只想检查文件是否不存在,使用的正确语法是什么?)
#!/bin/bash
FILE=$1
if [ $FILE does not exist ]; then
echo "File $FILE does not exist."
fi
ask by Bill the Lizard translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…