自动判断某一文件的类型

目的:自动判断系统中某一文件的属性。

#!/bin/bash
read -p "please input one file:" FILE
read -p "please input one dir:" DIR

if [ -e /$DIR/$FILE ];then
STRING=`/bin/ls -l -d $DIR/$FILE`RST
FIRSTCHAR=`echo ${STRING:0:1}`
case $FIRSTCHAR  in
-)
echo "the $DIR/$FILE is file";;
d)
echo "the $DIR/$FILE is dir";;
l)
echo "the $DIR/$FILE is link file";;
*)
exit
esac
else
echo " the $DIR/$FILE IS NOT EXIST:"
fi