1.判断/shell/aa存在
写一个脚本file_exitsts.sh,内容如下:
#!/bin/bash
if [ -e /shell/aa ]
then
echo "the file exists!"
else
echo "the file not exists"
fi
2.
[oracle@localhost shell]$ [ -e /shell/aa ]
[oracle@localhost shell]$ echo $?
0
结果为0表明文件存在,结果为1表明文件不存在!