分类: 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 "