Linux Expect脚本中的rsync

Linux Expect脚本中的rsync,linux,scripting,rsync,expect,Linux,Scripting,Rsync,Expect,上面的脚本有什么问题?我从man rsync中得到一个错误,称rsync选项无效,这是多个文件的新语法: #!/usr/bin/expect -f #set timeout 25 spawn rsync root@14.12.123.82:'/usr/backups /usr/backup-scripts /root/test/' /root/ expect "root@14.12.123.82's password: $"

上面的脚本有什么问题?我从
man rsync
中得到一个错误,称rsync选项无效,这是多个文件的新语法:

     #!/usr/bin/expect -f
        #set timeout 25
        spawn rsync root@14.12.123.82:'/usr/backups /usr/backup-scripts /root/test/' /root/
        expect "root@14.12.123.82's password: $"
        #send "\$xxxxxx\n"
        #expect "\\$ $
您正在使用的旧语法应该仍然可以在命令行中使用,但请在
spawn
中尝试:

rsync -av host:file1 :file2 host:file{3,4} /dest/

是的,我做了,效果很好。请注意,我没有与您相同的设置。也可以看看这里:-这里有一些关于如何做的例子,可能对你有用。
spawn rsync root@14.12.123.82:/usr/backups :/usr/backup-scripts :/root/test/ /root/