这是一个简单的shell脚本,里面包含了很多的shell脚本编写技巧,虽然脚本是从别的视频教程里面整理而来,但是对我的以后的编写shell脚本的道路有了一定的铺垫。
#!/bin/bash ############# # main menu # ############# main_menu () { echo echo dis_mainmenu="CREATE MINISITE IN CHINAITLAB.COM" curdate=`date "+%Y-%m-%d %T"` cat <<mayday DATE :$curdate ============================================ $dis_mainmenu ============================================ ** 1)ADD MINISITE ACCOUNT ** ** 2)ADD DOMAIN IN CHINAITLAB.COM ** ** 3)ADD DATABASE IN MYSQL ** ** 4)ADD VIRTUAL HOST IN APACHE ** ** 5)BACK MINISITE ** ** 6)DELETE MINISITE ** ** 7)EXIT ** mayday } while [ $loopvar -gt 0 ] do main_mean echo -n " please choose[1-7]:" read main_choice case $main_choice in 7) exit ;; *) clear esac done