判断文件类型
#!/bin/bash
read -p "Please input a filename:" file
if [ -z "$file" ];then
echo "Error,please input a filename"
exit 1
elif [ ! -e "$file" ];then
echo "Your input is not exist"
exit 2
elif [ -d "$file" ];then
echo "$file is a 目录文件"
elif [ -f "$file" ];then
echo "$file is a 普通文件"
else
echo "你输入的文件是其他文件类型"
fi
shell脚本之判断文件类型
最新推荐文章于 2020-09-12 07:19:03 发布