shell if判断文件是否存在
可以使用以下命令来判断文件是否存在:
if [ -e /path/to/file ]; then
echo "File exists"
else
echo "File does not exist"
fi
这个命令中,-e
参数用来判断文件是否存在,/path/to/file
是要判断的文件路径。如果文件存在,则输出"File exists",否则输出"File does not exist"。
可以使用以下命令来判断文件是否存在:
if [ -e /path/to/file ]; then
echo "File exists"
else
echo "File does not exist"
fi
这个命令中,-e
参数用来判断文件是否存在,/path/to/file
是要判断的文件路径。如果文件存在,则输出"File exists",否则输出"File does not exist"。
扫码添加客服微信