How to handle tcl expect output
问题 I am writing an expect script to telnet to the router ,do some config,expect some output. If the required prompt is not available then it waits for it and gets time out. So how do i have to handle this and print an error msg. set timeout 30; puts "Telnet to $IP 2361\n\n"; spawn telnet $IP 2361; expect ">"; send "ACT-USER::$user_name:1::$password;"; expect ">"; How do i handle and print an error msg if the expected value is not received? 回答1: Dealing with timeouts nicely requires a slightly