问题:在使用rsync expect 远程备份文件时发现下载的文件为空
解决:其中原因就在于set timeout -1 将超时时间设置为永不超时
#!/usr/bin/expect -f
set num [lindex $argv 0]
set timeout -1
spawn rsync -arvzp root@192.168.3.100:/nfs/bigdata/system/course/$num /home/bak/
expect "password"
send "111111\r"
#interact
expect eof