read -p"please input a filename!" -t 30 filename
if [ -z $filename];then
echo "please input!!!!!!"
exit 1
fi
#如果字符串为空,报错跳出
if [ ! -e $filename]
then
echo "$filename notcunzai!!"
exit 2
fi
#如果文件不存在,报错跳出
if [ ! -d $filename]
then
echo "$filename is notdriectory"
exit 3
fi
#如果不是目录,报错跳出
file=`ls $filename`
for test in $file
do
echo $test
done