getting rid of telnet prompt

Discussion in 'Perl Misc' started by mike, Jan 9, 2004.

  1. mike

    mike Guest

    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
    mike, Jan 9, 2004
    #1
    1. Advertising

  2. In article <>,
    mike <> wrote:
    :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.
    --
    Oh, yeah, an African swallow maybe, but not a European swallow.
    That's my point.
    Walter Roberson, Jan 9, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pete Johansen

    NET::Telnet prompt regular expression

    Pete Johansen, May 5, 2004, in forum: Perl
    Replies:
    0
    Views:
    1,122
    Pete Johansen
    May 5, 2004
  2. Jim Isaacson
    Replies:
    5
    Views:
    593
    Default User
    Nov 5, 2004
  3. Carcarius
    Replies:
    0
    Views:
    275
    Carcarius
    Dec 6, 2007
  4. Eric Lewton
    Replies:
    3
    Views:
    108
    Eric Lewton
    Dec 1, 2003
  5. Replies:
    1
    Views:
    115
    Gregory Toomey
    Apr 8, 2004
Loading...

Share This Page