# 保存到 fileName.sh
# 执行 sh fileName.sh
function menu() {
echo
echo "=============显示菜单============="
echo "| 1 - menu1"
echo "| 2 - menu2"
echo "| 3 - menu3"
echo "| 4 - menu4"
echo "| q - 退出"
echo "---------------------------------"
printf "请选择菜单:"
read -n 1 n
echo
if [[ "$n" = "1" ]]; then
echo $n
elif [ "$n" = "2" ]; then
echo $n
elif [ "$n" = "3" ]; then
echo $n
elif [ "$n" = "4" ]; then
echo $n
elif [ "$n" = "q" ]; then
echo 退出
return
else
echo "other"
fi
menu
}
menu
效果图
打包上传svn
网友评论