sumeet1802
IS-IT--Management
Hi ,
I am trying to telnet to a server using an expect script which I want to be embedded in Perl.
Once a telnet session is established I should be able to send commands and get data from the result.
I have implemented so that I am able to send commands and get the complete session on a file. I would have to search and parse data and do all sort of editing.
I need a live telnet session which should be able to send commands and get results in one session.
The script used so far is:-
#!/usr/pde/tcl/bin/hppa/expect
spawn /usr/bin/telnet servername
expect login:
send "name password"
send "\n"
expect "TERM = (xterm)"
expect "SOME_PROMPT (I.E. $>)"
send "commands\r"
expect "SOME_PROMPT (I.E. $>)"
send "more commands \r"
expect "SOME_PROMPT (I.E. $>)"
send "logout"\n"
send "\n"
interact {
}
There is some problem at logout .......too .....
Need help for the same ...
Thanks,
Sumeet
I am trying to telnet to a server using an expect script which I want to be embedded in Perl.
Once a telnet session is established I should be able to send commands and get data from the result.
I have implemented so that I am able to send commands and get the complete session on a file. I would have to search and parse data and do all sort of editing.
I need a live telnet session which should be able to send commands and get results in one session.
The script used so far is:-
#!/usr/pde/tcl/bin/hppa/expect
spawn /usr/bin/telnet servername
expect login:
send "name password"
send "\n"
expect "TERM = (xterm)"
expect "SOME_PROMPT (I.E. $>)"
send "commands\r"
expect "SOME_PROMPT (I.E. $>)"
send "more commands \r"
expect "SOME_PROMPT (I.E. $>)"
send "logout"\n"
send "\n"
interact {
}
There is some problem at logout .......too .....
Need help for the same ...
Thanks,
Sumeet