Timeout 在我的expect脚本中,它在哪里超时?
在我的expect脚本expect_after中,捕获来自BadPromptPassword的超时,但是如何返回这是我的expect脚本超时的地方?我已经和expect_玩过了,它没有给我我需要的东西。。。谢谢你的帮助。谢谢Timeout 在我的expect脚本中,它在哪里超时?,timeout,expect,Timeout,Expect,在我的expect脚本expect_after中,捕获来自BadPromptPassword的超时,但是如何返回这是我的expect脚本超时的地方?我已经和expect_玩过了,它没有给我我需要的东西。。。谢谢你的帮助。谢谢 spawn telnet 172.27.228.239 expect { timeout { puts "Timed out waiting for response from telnet ('172.27.228.230',)."; exit 1} "P
spawn telnet 172.27.228.239
expect {
timeout { puts "Timed out waiting for response from telnet ('172.27.228.230',)."; exit 1}
"Password:" { send "lab\r"; }
"\[>#\]"
};
send "en\r"
expect_after {
timeout {
puts "a default timeout clause for all subsequent expect commands ";
exit 1
}
}
expect "#>"
send "admin"
expect "BadPromptPassword:"
send "lab\r"
close
wait
这里有一个快速破解
expect_after {
timeout {
puts "timed-out expecting $pattern";
exit 1
}
}
set pattern "#>"
expect $pattern
send "admin"
set pattern "BadPromptPassword:"
expect $pattern
send "lab\r"