#! /usr/bin/env perl
use strict;
use warnings;
use feature qw(say); # Replaces 'print' with 'say'
use Net::SSH::Perl;
use constant {
HOST => '10.220.15.24',
USER => 'admin',
PASSWORD => 'admin',
};
my $ssh = Net::SSH::Perl->new( HOST )
or die qq(Can't SSH to host.);
$ssh->login( USER, PASSWORD );
or die qq(Can't log into host.);
say "check the version of the build";
say "enter the config mode";
say " ahmed ";
my ( $stdout, $stderr, $exit_code ) = $ssh->cmd("show vlan")
or die qq(Can't execute command.);
if ( $exit_code ) {
say "Command returned an exit code of $exit_code"
}
say $stdout;`
It’s been EONs since I’ve done any perl (like 15ish years), but that or die on the ssh->cmd(“show vlan”) line doesn’t look right.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.