From f0e213e02bcc87ecf70ab89e965ef9f27d736d69 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Tue, 1 Mar 2016 17:24:15 +0000 Subject: [PATCH] Option ssh --- bin/dbq | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/dbq b/bin/dbq index 7d7409a6..a2ebcc45 100755 --- a/bin/dbq +++ b/bin/dbq @@ -54,6 +54,7 @@ my $CURL_OPT_EXP = join('|',map{ /^(.*?)\|/ ? $1 : $_ } @CURL_OPT); my $VERBOSE = $main::VERBOSE = 0; my $DEBUG = $main::DEBUG = 0; +exec('ssh',$ARGV[0] && shift @ARGV,$NAME,@ARGV) if @ARGV and $ARGV[0] eq '--ssh' and shift @ARGV; csv2txt("\t",shift @ARGV) if @ARGV and $ARGV[0] eq '--csv2txt' and shift @ARGV; curl_help() if @ARGV and $ARGV[0] eq '--curl_help' and shift @ARGV; parse_debug() if @ARGV and $ARGV[0] eq '--parse_debug' and shift @ARGV; @@ -152,7 +153,7 @@ if ($keys{format} eq 'nc') { ################################################################################# # Push key=value -push(@cmd,map {('--data-binary',esc($_).'='.esc($keys{$_}))} sort keys %keys); +push(@cmd,map {('--data-binary',uri_esc($_).'='.uri_esc($keys{$_}))} sort keys %keys); warn "$NAME: Command: ",join(" ",map{/\s+/ ? '"'.$_.'"' : $_} @cmd),"\n" if $VERBOSE; system @cmd; @@ -243,7 +244,7 @@ sub csv2txt { exit; } -sub esc { +sub uri_esc { return URI::Escape::uri_escape($_[0]); local $_=shift;s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; return $_; @@ -392,6 +393,7 @@ Curl wrapper =head1 OPTIONS + option[ssh=s] SERVER Run the script on that server option[verbose|v+] Verbose mode: increase the verbosity level. option[debug+] Debug mode: increase the verbosity level. option[version|V] Print version (default: $VERSION) -- 2.47.3