shell case命令
case用法
case 值 in 模式1) command1 command2 command3 ;; 模式2) command1 command2 command3 ;; *) command1 command2 command3 ;; esac
值可以为变量或常数
注意 模式1) 模式2) *) 都有一个右括号
每个模式结束后用双分号结束;;
示例
echo ‘Input a number:‘ read Num case $Num in 1) echo ‘You select 1‘ ;; 2) echo ‘You select 2‘ ;; 3) echo ‘You select 3‘ ;; 4|5) echo ‘You select 4 or 5‘ ;; *) echo ‘default‘ ;; esac
相关推荐
wl00 2020-10-28
tianyafengxin 2020-10-08
WenCoo 2020-09-16
CoderMannul 2020-09-07
taomengxing 2020-09-07
了凡 2020-08-17
jackadmi 2020-08-03
一世为白 2020-08-03
dongfangxiaozi 2020-08-02
老甘的可读区 2020-07-18
kehanxin 2020-07-05
liusarazhang 2020-07-04
zlsh00 2020-06-28
Jieen 2020-06-28
leodengzx 2020-06-28
Fightingxr 2020-06-26
fenxinzi 2020-06-25
liuhuashui 2020-06-24