Shell编程 之 多分支case语句
1. 结构
2. 案例
#!/bin/bash echo "wayne : input 1" echo "echo : input 2" echo "we : input 3" read -t 30 -p "input your choice: " cho case "$cho" in "1") echo "wayne love echo" ;; "2") echo "echo love wayne" ;; "3") echo "we love ew" ;; *) echo "no no no" ;; esac ~ ~ ~ "case2.sh" 22L, 274C
#!/bin/bash read -t 30 -p "input yes or no: " cho case "$cho" in "yes") echo "your input is yes" ;; "no") echo "your input is no" ;; *) echo "invalid inputs" ;; esac ~ ~ ~ "case1.sh" 15L, 184C
posted on 2017-02-12 15:02 你的踏板车要滑向哪里 阅读(119) 评论(0) 编辑 收藏 举报