标签:lease ase bin else inf mamicode bash mic http
判断文件类型
#!/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
标签:lease ase bin else inf mamicode bash mic http
原文地址:https://blog.51cto.com/11342825/2422341