- package require Expect
- #!/usr/bin/expect
- set ipaddr 127.0.0.2
- set usrname "me"
- set passwd "who"
- for {set i 1} {$i < 11} {incr i} {
- spawn telnet $ipaddr
- expect "y/n"
- send "nr"
- expect "login:"
- send "$usrnamer"
- expect "password:"
- send "$passwdr"
- expect "*>"
- send "verr"
- expect ">"
- #send "showrn"
- #expect "INSERVICErn#"
- #exec command.com /c control
- send "exitrn"
- #expect eof
- puts "$i telnet terminal is over!"
- }
- puts "script is over!"