linux编写shell脚本实现查询 /home/test文件夹下是否存在a这个文件

存在则输出存在,否则输出不存在

if [ -f "/home/test/a" ]; then
echo myfile exists
else
echo myfile dose not exists
fi

[ -e FILE ] 如果 FILE 存在则为真。
[ -f FILE ] 如果 FILE 存在且是一个普通文件则为真。
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答