shell 批量上传文件

1470阅读 0评论2011-12-27 initrdimg
分类:LINUX

#!/bin/bash
#作者:罗宏江
#QQ:123769752
#mail:g_linux@qq.com
#原创---请你转载说明出处,请支持别人的劳动成果。
declare -i rstog stog
rstog=0
stog=0
>sdf_error.log
IP="
132.225.129.999
"
if (( $# == 0 ));then   #检查输入的参数,是不是正确的。
 echo "Format: $0 [sourcefile -remotefile],[-remotefile sourcefile]"
   exit
fi
while (( $# ))
do
{
        if [[ ! -e $1 ]];then  # 判断不是文件
        {       rstog=$rstog+1
                rmpath=$1
                rmpath=${rmpath:1}
                shift
         
                if [[ ! -e $1 ]];then # 判断不是文件
                {                 
                   echo "nofile">sdf_error.log                       
                                
                    
                 }
                  else
                 {
                  stog=$stog+1
                  file=$1
                  shift
                  }   
                fi
                
                
           }  
           else
           {
            stog=$stog+1
            file=$1
            shift
           }   
          fi
 
}
done
if (( $stog <= 1 && $rstog <= 1 ));then
for i in ${IP[*]}
{
       
          scp -r $file &
}
fi
上一篇:iptables中DNAT与SNAT,MASQUERADE的理解
下一篇:vim tab键自动补全