此处观察到的脚本和消息:
[root@server01 ~]# cat /usr/local/scripts/rsync.exp
#!/usr/bin/expect
eval spawn rsync -av --delete /backup/ root@server02:/backup
;#use correct prompt
set prompt ":|#|\\\$"
interact -o -nobuffer -re $prompt return
send "welcome123\r"
interact -o -nobuffer -re $prompt return
send "pwd"
interact -o -nobuffer -re $prompt return
expect "#"
expect eof
[root@server01 ~]#
expect: spawn id exp4 not open
while executing
"expect "#""
(file "/usr/local/scripts/rsync.exp" line 13)
[root@server01 ~]#
当我在命令行使用ctrl + d终止时,我看到上面的错误。