标签:shell脚本
#!/bin/bash
#auth chentp0601
#date 20151123
function menu()
{
clear
cat <<EOF
#this is base menu
1.[install lamp]
2.[install lnmp]
3.[exit]
EOF
read -p "please input 1-3:" list
case $list in
"1")
while true
do
menu_lamp
done
;;
"2")
while true
do
menu_lnmp
done
;;
"3")
echo -e "exiting . . .\n";
sleep 1
exit 0
;;
*)
continue
;;
esac
}
function menu_lamp()
{
clear
cat <<EOF
#this is lamp menue
1.[install apache]
2.[install mysql]
3.[install php]
4.[back]
EOF
read -p "please input 1-3:" list1
case $list1 in
"1")
echo -e "installing apache\n"
sleep 2
continue
;;
"2")
echo -e "installing mysql\n"
sleep 2
;;
"3")
echo -e "installing php\n"
sleep 2
;;
"4")
break
;;
*)
continue
;;
esac
}
function menu_lnmp()
{
clear
cat <<EOF
#this is lnmp menu
1.[install nginx]
2.[install mysql]
3.[install php]
4.[back]
EOF
read -p "please input 1-4:" list2
case $list2 in
"1")
echo -e "installing nginx\n"
sleep 2
continue
;;
"2")
echo -e "installing mysql\n"
sleep 2
;;
"3")
echo -e "installing php\n"
sleep 2
;;
"4")
break
;;
*)
continue
;;
esac
}
while true
do
menu
done
本文出自 “前进吧菜鸟” 博客,请务必保留此出处http://chentp.blog.51cto.com/10638759/1716086
标签:shell脚本
原文地址:http://chentp.blog.51cto.com/10638759/1716086