1、case条件语句
case "变量" in
值1)
指令1...
;;
值2)
指令2...
;;
*)
指令3...
esac
[root@localhost shell]# cat 9.sh #!/bin/bash read -p "Please input a number:" ans case "$ans" in 1) echo "The num you input is 1" ;; 2) echo "The num you input is 2" ;; *) echo "Please input 0-9 int" esac