#!/bin/bash
#filename=detect_file_type
echo "please input a file name:"
read file_name
if [ -d $file_name ]
then
echo "$file_name is a directory"
elif [ -f $file_name ]
then
echo "$file_name is a common file"
elif [ -c $file_name -o -b $file_name ]
then
echo "$file_name is a device file"
else
echo "$file_name is an unknown file"
fi
2016-11-16
测试文件类型if...else
评论
发表评论
姓 名: