if case

时间:2014-10-28 19:30:13   收藏:0   阅读:168

#!/bin/bash
a=$1
if [ $a ]  #判断$1是否为空
then  #非空
echo "the input is: $a"
else  #空
echo "input a int:"
read a
case $a in
"1")
echo "your input is $a"
;;
"2")


echo "your input is $a"
;;
*)
echo "dont know"
;;
esac

fi

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!