shell实现菜单选择

来源:互联网 发布:linux 发送广播 编辑:程序博客网 时间:2024/05/06 01:57
output="Is today your birthay: "echo  -e "\n"selectmenu_selections in Yes No Quitdocase $menu_selections inYes) echo -e "\nHappy Birthday!\n"     ;;No)  echo -e "\nIt is someone's birthaday today...sorry it is not yours\n"     ;;Quit)echo -e "\nLater tater!\n"     break             ;;*)   echo -e "\nInvalid Answer...Please try again\n"             ;;           esacdone

output变量是表示提示语,select后面跟的yes no quit可以看成一个数组,按键1选择yes,2选择no,3选择quit。达到菜单的目的。