#!/bin/bash IPList=("192.168.1.234" "118.126.88.17") OutPath=("/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 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 ../\cfg/\data) do Array[$countTxt]=$i echo -e $countTxt "\t for \t" ${Array[$countTxt]} let countTxt=countTxt+1 done read ArrayPathNum echo ${ArrayPathNum[@]} strtxt="" for i in ${ArrayPathNum[@]} do strtxt=$strtxt" ../cfg/data/"${Array[$i]} done echo strtxt scp -P$Port $strtxt mmog@$IP:$Path