#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2009
    Posts
    4
    Rep Power
    0

    Print not fully printing


    I am using expect module while connecting to my router to get information on certain interfaces. When I execute the command on the router I get back most of the info from the command but I'm still missing like 10-15 lines. Any suggestions as to what's up?

    #!/usr/bin/perl -w

    #use strict;
    use warnings;
    use Net::SSH::Expect;

    my $ssh = Net::SSH::Expect->new (
    host => "10.10.10.10",
    user => 'user',
    password => 'pass'
    );
    my $login_output = $ssh->login();
    if ($login_output !~ /router#/) {
    die "Login has failed. Login output was $login_output";
    }
    #$ssh->run_ssh() or die "SSH process couldn't start: $!";
    $ssh->send("show int g2/1");
    my $line;

    while (defined ($line = $ssh->read_line()) ) {
    print $line."\n";
    }
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Location
    Saint-Petersburg, Russia
    Posts
    236
    Rep Power
    28
    Try flushing output when you exit loop. Though I am not sure this is the problem in your case - but looks too similar, so I think it should be checked first...
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2009
    Posts
    4
    Rep Power
    0
    Not sure what you are talking about, I have some perl experience but have not used it in about 10 years....
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2012
    Posts
    828
    Rep Power
    496
    You're probably suffering from buffering. Take a look at this article
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2009
    Posts
    4
    Rep Power
    0
    Thanks I'll have a look.

IMN logo majestic logo threadwatch logo seochat tools logo