diff --git a/main.sh b/main.sh index 830d2b4..768c934 100644 --- a/main.sh +++ b/main.sh @@ -18,11 +18,16 @@ show_menu() { echo -e "0. ${RED}退出${NC}" } -show_filer(){ +show_folder(){ filer=$1 ls -l /data/update/$filer/ |awk '/^d/ {print $NF}' } +show_file(){ + filer=$1 + ls -l /data/update/$filer/ |awk '{print $NF}' +} + # 定义函数,用于处理用户输入 handle_input() { read -p "请输入选项编号: " choice @@ -76,10 +81,10 @@ game(){ case $choice in 1) echo -e "${YELLOW}打包${NC}" - show_filer project + show_folder project stty erase ^h read -p "请输入项目地址: " project - show_filer package + show_file package stty erase ^h read -p "请输入包名(不需要带文件后缀): " package echo -e "开始打包 项目:$project, 包名:$package" @@ -88,7 +93,7 @@ game(){ ;; 2) echo -e "${YELLOW}单独发送${NC}" - show_filer package + show_file package stty erase ^h read -p "请输入包名(不需要带文件后缀): " package stty erase ^h @@ -99,10 +104,10 @@ game(){ ;; 3) echo -e "${YELLOW}渠道发送${NC}" - show_filer package + show_file package stty erase ^h read -p "请输入包名(不需要带文件后缀): " package - show_filer script/txt + show_file script/txt stty erase ^h read -p "请输入文件名称(不需要带文件后缀): " iptxt echo -e "开始发送 包名:$package, 渠道:$iptxt" @@ -111,7 +116,7 @@ game(){ ;; 4) echo -e "${YELLOW}单独发送并重启${NC}" - show_filer package + show_file package stty erase ^h read -p "请输入包名(不需要带文件后缀): " package stty erase ^h @@ -123,10 +128,10 @@ game(){ ;; 5) echo -e "${YELLOW}渠道发送并重启${NC}" - show_filer package + show_file package stty erase ^h read -p "请输入包名(不需要带文件后缀): " package - show_filer script/txt + show_file script/txt stty erase ^h read -p "请输入文件名称(不需要带文件后缀): " iptxt echo -e "开始发送 包名:$package, 渠道:$iptxt" @@ -190,7 +195,7 @@ gm(){ case $choice in 1) echo -e "${YELLOW}单渠道更新${NC}" - show_filer project + show_folder project stty erase ^h read -p "请输入表所在游戏项目地址: " project stty erase ^h @@ -201,7 +206,7 @@ gm(){ ;; 2) echo -e "${YELLOW}多渠道更新${NC}" - show_filer project + show_folder project stty erase ^h read -p "请输入项目地址: " project echo -e "开始更新gm" @@ -230,6 +235,7 @@ login(){ case $choice in 1) echo -e "${YELLOW}登陆服更新${NC}" + stty erase ^h read -p "请输入登陆服ip: " ip echo -e "开始更新登陆服 ip:$ip" bash update_login.sh $ip @@ -237,6 +243,7 @@ login(){ ;; 2) echo -e "${YELLOW}登陆服重启${NC}" + stty erase ^h read -p "请输入登陆服ip: " ip echo -e "开始重启登陆服 ip:$ip" ssh $ip "bash /usr/local/apache-tomcat-7.0.79/bin/shutdown.sh" @@ -267,6 +274,7 @@ pay(){ case $choice in 1) echo -e "${YELLOW}支付服更新${NC}" + stty erase ^h read -p "请输入支付服ip: " ip echo -e "开始更新支付服 ip:$ip" bash update_delivery.sh $ip @@ -274,6 +282,7 @@ pay(){ ;; 2) echo -e "${YELLOW}支付服重启${NC}" + stty erase ^h read -p "请输入支付服ip: " ip echo -e "开始重启支付服 ip:$ip" ssh $ip "bash /data/jieling/delivery-server/pay_restart.sh" @@ -302,6 +311,7 @@ mingan(){ case $choice in 1) echo -e "${YELLOW}敏感词服更新${NC}" + stty erase ^h read -p "请输入敏感词服ip: " ip echo -e "开始更新敏感词服 ip:$ip" bash update_sensitive.sh $ip @@ -309,6 +319,7 @@ mingan(){ ;; 2) echo -e "${YELLOW}敏感词服重启${NC}" + stty erase ^h read -p "请输入敏感词服ip: " ip echo -e "开始重启敏感词服 ip:$ip" ssh $ip "bash /data/jieling/sensitiveWordFilter/bin/mingan_reboot.sh"