From bac91465d5f5848539deb9ce9145a97b884c9e84 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Sun, 14 May 2017 21:15:58 +0200 Subject: [PATCH] support multiple commands, find config in current dir --- dell-switch.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dell-switch.pl b/dell-switch.pl index 22d0ddd..65cc0be 100755 --- a/dell-switch.pl +++ b/dell-switch.pl @@ -11,6 +11,7 @@ our $login; our $passwd; our $debug = $ENV{DEBUG} || 0; +use lib '.'; require 'config.pl'; #$Net::OpenSSH::debug = ~0; @@ -64,8 +65,9 @@ sub save_log { } my $command; +my @commands_while = ( @commands ); -while(1) { +while() { my $data; my $read = sysread($pty, $data, 1); print STDERR $data; @@ -82,7 +84,7 @@ while(1) { save_log $ip, $hostname, $command, $buff; $buff = ''; } - if ( $command = shift @commands ) { + if ( $command = shift @commands_while ) { $command =~ s/[\n\r]+$//; send_pty "$command\n"; $buff = ''; -- 2.20.1