批量启动远程控制脚本

#!/bin/sh
path_current=`pwd`
path_script=$(cd "$(dirname "$0")"; pwd)
server=$1
cfg=$path_script/config
if [ $# -lt 0 ]; then
   awk '{if($1 == "Host"){print $2}}' $cfg
else
   len=${#server}-1
   star=${server:1-2}
   prefix=${server:0:len}
   if [ "$star" == "*" ];then
      servers=$(grep '^Host ' F:/tools/myssh/config | sort -u | sed 's/^Host //')
      for svc in ${servers}
      do
         svchit=${svc:0:len}
         if [ $svchit == $prefix ]; then
            if [ "$svchit*" != "$svc" ]; then            
               $path_script/exec.exe -F F:\\tools\\myssh\\config "$svc"
            fi
         fi
      done
      exit
   fi
   $path_script/exec.exe -F F:\\tools\\myssh\\config $*
fi