expect 脚本 例子

来源:互联网 发布:mac下载flash插件 编辑:程序博客网 时间:2024/05/22 01:51

#!/usr/bin/expect -f

set arg0 [ lindex $argv 0 ]
set arg1 [ lindex $argv 1 ]

set remoteip "172.31.13.101"


send_user "good/n"

spawn /usr/bin/scp emptydoc $remoteip:/home/xiawenbing/

expect "yes/no)?"  {send "yes/r"}  "password:" {send "realpassword/r"}

expect eof

exit

 

 

倒数第三行的 expect 行, 不能断成多行, 也不能分拆成多个平行的expect语句

原创粉丝点击