expect telnet session

August 16, 2010 at 11:13:21
Specs: linux
#telnet <ip_add> <port>
Trying a.b.c.d...
Connected to a.b.c.d.
Escape character is '^]'. << After that i have to
press enter
to get the router
prompt >>
router#
I am trying to automate this using expect but after
telnet router expect enter to come to prompt.
I have the following script.

spawn telnet <ip> <port>
expect "\n" << here in expect what should i use
for newline>>
send "\n"

but it is not working.After i execute spawn command script got hung.


See More: expect telnet session

Report •

#1
August 16, 2010 at 11:15:44
the above script is hanging like

#expect.proc
spawn telnet <ip> <.port>.
Trying a.b.c.d...

Connected to a.b.c.d.
Escape character is '^]'.


Report •

#2
August 16, 2010 at 11:16:37
spawn telnet <ip> <port>
expect "\n"
send "\n"

Report •
Related Solutions


Ask Question