Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1500384
  • 博文数量: 263
  • 博客积分: 10851
  • 博客等级: 上将
  • 技术积分: 2627
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-26 22:40
文章分类

全部博文(263)

文章存档

2013年(4)

2012年(25)

2011年(33)

2010年(50)

2009年(138)

2008年(13)

分类: LINUX

2009-11-04 00:30:01

在命令行直接执行rsync:

# rsync -avzrc  --bwlimit=1000 --include="*.sh" --include="*.shell" --include="*.bash" --include="*.jar" --include="*.jad"  --exclude="*"  ${SHELL_PATH} 10.128.36.190::dst_path

可以把所有后缀为.sh/.shell/.bash/.jar/.jad的文件都同步过去。

 

但是如果把同样的命令放在expect 脚本之中, 就会同步所有的文件过去(这是为什么? 估计是expect中对特殊字符的处理, 把rsync的一些选项给误解释了)

expect -c  "set timeout 300;
    spawn rsync -avrz -e \"ssh -q -C -p 36000 \" --include='*.sh' --include='*.shell' --include='*.bash' --include='*.jar' --include='*.jad' --exclude='*' ${SHELL_PATH} 10.128.36.190::dst_path ;
    expect {
     \"*yes/no)?\" { send \"yes\r\"; exp_continue; }
     \"*password:*\" { send \"mqq2005\r\"; }
    }
    expect eof "

阅读(7437) | 评论(0) | 转发(0) |
0

上一篇:Linux(BASH)命令搜索机制

下一篇:计划一下

给主人留下些什么吧!~~