hello,
#!/usr/bin/perl -w
use strict;
use Net::SSH::Perl;
my $command="sh ver";
my $prompt='/.*[>#]$/';
my $router= 'name';
my($stdout, $stderr, $exit);
my $ssh = Net::SSH::Perl->new($router,debug => 1, protocol => '2,1',use_pty
=> 1 );
$ssh->login('username','pass');
eval{ ($stdout, $stderr, $exit) = $ssh->cmd($command)};
print $stdout;
my aim is to display and pass the output of a command to a variable
i want to know where s my mistake , thanks
|