#!/bin/bash IPList=("192.168.1.2" "192.168.1.22" "192.168.1.222" "111.231.250.180" "150.109.151.80" "192.168.1.80" "119.28.105.46" "175.178.210.137" "175.178.27.155") OutPath=("/home/mmog/publish/TmpCfg" "/data/mmogrun/publish/cfg/data/") echo "请选择要更新的IP:" ipcount=0 for i in ${IPList[@]} do echo $ipcount for $i let ipcount=ipcount+1 done read IPnum IP=${IPList[$IPnum]} echo "您要更新的IP是:"$IP #Port=56000 echo "请输入端口号(默认22):" read Port if [ ! -n "$Port" ];then let Port=22 fi echo "您输入的端口号是:"$Port echo "请选择要更新的Path:" pathcount=0 for i in ${OutPath[@]} do echo $pathcount for $i let pathcount=pathcount+1 done read pathnum Path=${OutPath[$pathnum]} echo "您要更新的路径是:"$Path echo "请选择要更新的配置文件(输入序号,中间空格隔开):" countTxt=0 for i in $(ls ExcelExport/\win7-x64/\GameConfig/\Server) do Array[$countTxt]=$i echo -e $countTxt "\t for \t" ${Array[$countTxt]} let countTxt=countTxt+1 done echo "'all' for All Config" read ArrayPathNum echo ${ArrayPathNum[@]} strtxt="" if [ ${ArrayPathNum[0]} == "all" ];then echo ${ArrayPathNum[0]} strtxt=" ExcelExport/win7-x64/GameConfig/Server/*" else for i in ${ArrayPathNum[@]} do index=$i descName=${Array[$index]} strtxt=$strtxt" ExcelExport/win7-x64/GameConfig/Server/"${descName} done fi echo $strtxt scp -P$Port $strtxt mmog@$IP:$Path ssh -p$Port mmog@${IP}