case只能判断一种条件关系,而if能判断多种条件关系

【shell】case语句-LMLPHP

#!/bin/bash
read -p "please input your choice (high/middle/low):" -t 30 choice
case $choice in
"high")
echo "your choice is $choice"
;; ##千万别漏下
"middle")
echo "your choice is $choice"
;;
"low")
echo "your choice is $choice"
;;
*)
echo "error high/middle/low"
;;
esac ##千万别漏下

  

05-06 03:28