在shell中可以使用-e参数来判断文件是否存在。具体命令如下:
if [ -e file.txt ]; then echo "File exists"else echo "File not found"fi其中file.txt为要判断的文件名。如果文件存在,则会输出"File exists";如果文件不存在,则会输出"File not found"。
在shell中可以使用-e参数来判断文件是否存在。具体命令如下:
if [ -e file.txt ]; then echo "File exists"else echo "File not found"fi其中file.txt为要判断的文件名。如果文件存在,则会输出"File exists";如果文件不存在,则会输出"File not found"。