Posted to tcl by schelte at Wed Mar 12 21:48:42 GMT 2014view raw

  1. spawn telnet $ip
  2. match_max 100000
  3. expect -exact "Username:"
  4. send -- "$user\r"
  5. expect -exact "Password:"
  6. send -- "$password\r"
  7. expect -exact "#"
  8. send -- "terminal length 0\r"
  9. expect -exact "#"
  10. send -- "show run\r"
  11. expect -exact "#"
  12. set lines [split [string map [list \r\n \n] $expect_out(buffer)] \n]
  13. send -- "exit\r"
  14. expect eof
  15. wait -nowait
  16.