判断用户输入的是否为目录
#!/bin/bash
while :
do
echo "please input your dectory"
read filename
while :
do
if [ -d $filename ];then
echo "$filename is dectory";exit
else
echo "$filename is not found"
echo "please input exist D or mkdir"
read D
case $D in
A)read filename;;
B)break;;
*)echo "error";;
esac
fi
done
while :
do
F=$filename
echo "menu list"
echo "y:mkdir directory"
echo "n:not mkdir directory"
echo "*:input other .exit"
echo "please input choice y/n"
read X
case $X in
Y) mkdir $F;exit;;
N) echo "bu chuang jian ";exit;;
Q) break;;
esac
done
done
转载于:https://blog.51cto.com/12156768/1872210