#!/bin/bash
echo "enter a file name"
read a
if test -e /opt/$a
then
echo "the file is exit"
else
echo "the file is not exit"
fi
[root@nginx ~]# touch /opt/aa.txt #新建文件aa
[root@nginx ~]# ./file.sh 执行脚本
enter a file name
aa.txt
the file is exit #已存在
shell-查找opt目录下文件是否存在某个文件
最新推荐文章于 2023-11-17 21:21:31 发布