输入yes 或者no 用case命令

read -p "Please input yes or no: " ans
case $ans in
[Yy]|[Yy][Ee][Ss])
    echo YES;;
[Nn]|[Nn][Oo])
    echo NO;;
*)
    echo input false!
esac

列出菜单

cat <<EOF
1:lamian
2:huimian
3:daoxiaomian
4:zhajiangmian
EOF
read -p "please choose the number: " num
case $num in
1)
    echo "lamian price is 10";;
2)
    echo "huimian price is 12";;
3)
    echo "daoxiaomiao price is 14";;
4)
    echo "zhajiangmian price is 15";;
*)
    echo "INPUT false!"
esac
GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐