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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Overcome CLI paging

 



zeeboy
New User

Nov 28, 2011, 1:16 PM

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

Hi,

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:



Code
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
}


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

else{
#do nothing
}

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



}



zeeboy
New User

Nov 30, 2011, 1:36 AM

Post #2 of 2 (386 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