getting rid of telnet prompt

M

mike

hi

i used Telnet.pm to telnet to a remote server to get some directory listing
but the listing always includes the "prompt" of the remote server
how do i not display the "prompt" at the end of my listing?

my $telnet = Net::Telnet-> new
(
Timeout => 30,
Host=> "$server"
);
$telnet-> login($name, $pass);
@listing = $telnet-> cmd("$command");
$telnet->close;
print @listing;


thanks
 
W

Walter Roberson

:i used Telnet.pm to telnet to a remote server to get some directory listing
:but the listing always includes the "prompt" of the remote server
:how do i not display the "prompt" at the end of my listing?

:my $telnet = Net::Telnet-> new
: (
: Timeout => 30,
: Host=> "$server"
: );
: $telnet-> login($name, $pass);
: @listing = $telnet-> cmd("$command");
: $telnet->close;
:print @listing;

If it is a separate line at the beginning, then shift @listing

If it forms part of a line, then $listing[0] =~ s/the prompt//;
or as appropriate.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top