shell编程:case语法格式
case "$1" in
1)
echo 'one'
;;
[2-9])
echo 'one more';;
*)
echo 'other'
;;
esac
- 最后一个分支可以省略;; , 其他分支不可以省略
- ;;可以单独写在一行, 但是两个;中间不能有空格
当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »
case "$1" in
1)
echo 'one'
;;
[2-9])
echo 'one more';;
*)
echo 'other'
;;
esac
当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »