cd ./bin
if test -e ./bash
then
echo "file exist"
else
echo "file not exist"
fi
if test -e ./bash -o -e ./notfile
then
echo "at least one file exist"
else
echo "file both not exist"
fi
输出结果:
file exist
at least one file exist
shell脚本之用test判断文件是否存在
阅读 196
2022-06-06
cd ./bin
if test -e ./bash
then
echo "file exist"
else
echo "file not exist"
fi
if test -e ./bash -o -e ./notfile
then
echo "at least one file exist"
else
echo "file both not exist"
fi
输出结果:
file exist
at least one file exist
相关推荐
精彩评论(0)