projects
/
dell-switch
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5382e40
)
support multiple commands, find config in current dir
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sun, 14 May 2017 19:15:58 +0000
(21:15 +0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sun, 14 May 2017 19:15:58 +0000
(21:15 +0200)
dell-switch.pl
patch
|
blob
|
history
diff --git
a/dell-switch.pl
b/dell-switch.pl
index
22d0ddd
..
65cc0be
100755
(executable)
--- 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 = '';