02写一个shell脚本,实现简单的弹出式菜单功能,用户能根据显示的菜单项从键盘选择执行对应的命令。
参考答案1:#!/bin/bashPS3="Pleaseinputyourchoice(1-4):"selectiinwlspwdquitdocase$iinw)w;;ls)ls;;pwd)pwd;;quit)exit;;*)echo"Pleaseinput1-3.";;esacdone参考答案2:#!/bin/bashecho-e"1)w\n2)ls\n3)pwd\n4)quit"while:doread-p"Pleaseinputyourchoice(1-4):"ccase$cin1)w;;2)ls;;3)pwd;;4)exit;;*)echo"Pleaseinput1-4.";;esacdone
来自:shell-权限命令