
zeeboy
New User
Nov 28, 2011, 1:16 PM
Post #1 of 2
(234 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:
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); }
|