You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
334 B

  1. #!/usr/bin/expect
  2. # connect to telnet port, press return and expect argv 2 (hostname) in
  3. # prompt, press return again and expect to receive argv 2 again
  4. set timeout [lindex $argv 3]
  5. spawn telnet [lindex $argv 0] [lindex $argv 1]
  6. send "\r"
  7. expect {
  8. [lindex $argv 2]
  9. }
  10. send "\r"
  11. expect {
  12. [lindex $argv 2]
  13. { exit 0 }
  14. }
  15. exit 5