CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Overcome CLI paging


New User

Nov 28, 2011, 1:16 PM

Post #1 of 2 (465 views)
Overcome CLI paging Can't Post


I've got a script that SSHs into a non-cisco switch and issues a command to show the current configuration on it then saves it to a text file line by line. It works fine till the terminal gets to

Press any key to continue (Q to quit)

then it doesn't save any line after it so I only get the output before the Press any key to continue prompt. I added a line in there that looks for the promtp and passes a spacebar but that doesn't work...Please see part of my script below:

my $sap1201a = $ssh->send("configure qos ingress 1201\r"); 
my $sap1201b = $ssh->send("info\r");
my $line4;

unlink "3.txt" or print "";

while ( defined ($line4 = $ssh->read_line()) ) {

if ($line4 =~ m/configure qos sap-ingress 1201/ ){
#do nothing
elsif ($line4 =~ m/info/){
#do nothing

if ($line4 =~ m/Press any key to continue/ ){
my $ssh1201c = $ssh->send(" ");

#do nothing

open(MYFILE,'>>3.txt') or die "Can't create new.txt: $!";
print MYFILE "$line4\n";
close (MYFILE);


New User

Nov 30, 2011, 1:36 AM

Post #2 of 2 (456 views)
Re: [zeeboy] Overcome CLI paging [In reply to] Can't Post

I found the solution...Best thing to do is turn off paging on the device. It would be nice to know how to emulate a send key though.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives