0
点赞
收藏
分享

微信扫一扫

shell脚本之用test判断文件是否存在

海牙秋天 2022-06-06 阅读 158
#!/bin/bash
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 条评论