shell-case命令的使用
if语句中存在如下逻辑处理
if ((a==1));then
commands
elif ((a==2));then
commands
elif ((a==5));then
commands
else
commands
fi
case语句的语法
case $var in
pattern1)
commands
;;
pattern2)
commands
;;
esac
pattern 可以是具体的值 可以是通配符 可以是正则表达式
- 表示所有
case $1 in
tom)
echo "hello tom"
;;
danny)
echo "hello danny"
;;
*)
echo ”hello everyone,thank u“
;;
";;"类似于case在Java中的break