+ -
当前位置:首页 → 问答吧 → 一段很好的expect脚本,求解释

一段很好的expect脚本,求解释

时间:2011-05-14

来源:互联网

如题,每句话分别什么意思
expect {
Password: {
stty -echo
send_user password (for $user) on $host: expect_user -re (.*)\n" send_user \n"
send $expect_out(1,string)\r" stty echo
exp_continue
} incorrect {
send_user invalid password or account\n" exit
} timeout {
send_user connection to $host timed out\n" exit
} eof {
send_user \
connection to host failed: $expect_out(buffer)" exit
} -re $prompt
}

作者: fufelixzh   发布时间: 2011-05-14

另外发现expect语法,puts只能打印变量,不能打印常量
如puts $rcs is right
puts "123" 不报错,但是没有说出。
puts stderr "123" 也是

作者: fufelixzh   发布时间: 2011-05-14