#!/usr/bin/perl -w use strict; use warnings; use 5.010; ###prompt for host### print "Host IP "; my $host = <>; ##Setup connection### use Net::SSH::Perl; my $ssh = Net::SSH::Perl->new($host); $ssh->login('user', 'pw'); ###run commands### my($run) = $ssh->cmd("show run"); ##create file and write to it### my $filename = $host; open(my $fh, '>', $filename) or die "Could not open file '$filename' $ +!"; say $fh ($run); close $fh; say 'done'
In reply to Perl Script to enable Cisco by Null_Route0
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |