expect 脚本 例子

#!/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语句

你可能感兴趣的:(expect 脚本 例子)