- 论坛徽章:
- 0
|
我刚刚得到一个菜单程序,给你分享一下,可能没有你要求的那样功能全,但能实现菜单的基本调用.
代码:
menu(){
clear
date "+ 20%y:%m:%d
%T"
echo "\t ────────────────────────────── "
echo "\n\n\n\t\t ~ 简单的菜单程序 ~"
echo "\033[9;25H 1.──────目录一"
echo "\033[10;25H "
echo "\033[11;25H 2.──────目录二"
echo "\033[12;25H "
echo "\033[13;25H 3.──────目录三"
echo "\033[14;25H "
echo "\033[15;25H 4.──────目录四"
echo "\033[16;25H "
echo "\033[17;25H 0.──────退出"
echo "\033[23;11H "
echo "\033[24;11H─────────────────────────────?
?
echo "\033[22;30H 请选择:\c"
}
while [ 1 ]
do
menu
read ans
if [ "$ans" = 0 ]
then
setcolor -n
clear
exit
fi
if [ "$ans" -lt 1 -o "$ans" -gt 4 ]
then
echo "\033[20;62H 选择无效^G^G"
read cc
else
clear
case $ans in
1)
test1.sh
;;
2)
test2.sh
;;
3)
test3.sh
;;
4)
test4.sh
;;
esac
fi
done
其中,test1.sh test2.sh test3.sh test4.sh 的具体功能必须你自己加入 |
|