此菜单Shell脚本允许我执行命令,但是还是有问题;输入选项后,命令将运行,并且在结果清除后立即显示菜单。
#!/bin/sh
LOGO="t13 Menu"
amenu="a. db" ;
bmenu="b. listening ports " ;
cmenu="c. Display Directory Listing " ;
dmenu="d. MenuCID " ;
badchoice () { MSG="Invalid Selection ... Please Try Again" ; }
apick () { ps -rf | grep pemon ;}
bpick () { lsof -n | grep LISTEN ; }
cpick () { ls -ltr | more ; }
dpick () { menujob ; }
clear
themenu () {
echo `date`
echo
echo "\t\t\t" $LOGO
echo
echo "\t\tPlease Select:"
echo
echo "\t\t\t" $amenu
echo "\t\t\t" $bmenu
echo "\t\t\t" $cmenu
echo "\t\t\t" $dmenu
echo
echo
echo "\t\t\t\tx. Exit"
echo
echo $MSG
echo
echo Select by pressing the letter and then ENTER ;
}
MSG=
while true
do
themenu
read answer
MSG=
case $answer in
a|A) apick;;
b|B) bpick;;
c|C) cpick;;
d|D) dpick;;
e|E) epick;;
x|X) break;;
*) badchoice;;
esac
done
我期望的是: 输入选择后,结果将显示出来,我需要按Enter键。1.清除终端,然后再次显示菜单。
答案 0 :(得分:0)
也许是这样的:
.
.
.
esac
echo ""
echo "Press <ENTER> to return to the menu..."
read junk
clear
done