Wondering if there is a simple solution to the coding problem I have encountered. I ssh into a box and run a command to show some settings how ever if the amount of data returned is larger than the screen window you have to hit a key to continue. Is there a way to simulate hitting a key to continue printing the output to a file? ssh -l admin xxx.xxx.xxx.xxx admin's password: xxxxx
#!/bin/perl use Net::SSH::Expect; my $ssh = Net::SSH::Expect->new ( host => $host, password=> $pass, user => $user, raw_pty => 1, timeout => 3 ); my $login_output = $ssh->login(); if ($login_output !~ />/) { die "Login has failed. Login output was $login_output"; } my $who = $ssh->send("show config\n"); while ( defined ($line = $ssh->read_line()) ) { print $line . "\n"; } close $line; $ssh->close();
In reply to Wait for string by mrbullman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |