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