expect - telnet connection
问题 I'm trying to create a simple telnet connection script. I spawn telnet process. Depending on the version, it may or may not ask for password. After that It asks for username and password and rulese acceptation. After successful login it prompts for command. However, thing I wrote does not work. #/usr/bin/expect -f set IP [lindex $argv 0] set timeout 10 set send_slow {10 .5} log_user 1 spawn telnet -l cli $IP expect { timeout { puts "Network Connection Problem" close } "Password:" { send -s --