From 29795924870e9a56a11e4d4b92f9111f428362c4 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Wed, 2 Mar 2016 02:44:37 +0000 Subject: [PATCH] dbq ssh proto --- bin/dbq | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bin/dbq b/bin/dbq index f4db121e..2bf2bafa 100755 --- a/bin/dbq +++ b/bin/dbq @@ -54,11 +54,11 @@ 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; curl_help_hash() if @ARGV and $ARGV[0] eq '--curl_help_hash' and shift @ARGV; +my @EXEC = @ARGV; my %Opt = map{ (/^(.*?)\|/ ? $1 : $_) => $CURL_OPT{$_} } keys %CURL_OPT; @@ -91,7 +91,16 @@ for my $o (@CURL_OPT) { my @cmd; my $url; $url = ($ENV{$UC_NAME.'_URL'} ? $ENV{$UC_NAME.'_URL'} : '/opt/rent/www/index.php'); -$url = shift @ARGV if @ARGV and ($ARGV[0] =~ m|^\w+://| or -e $ARGV[0] ); +if (!$Opt{ssh} and @ARGV and ($ARGV[0] =~ m|^\w+://| or -e $ARGV[0] )) { + $url = shift @ARGV; + shift @EXEC; +} +#die $Opt{ssh}; +#exec('ssh',$ARGV[0] && shift @ARGV,$NAME,@ARGV) if @ARGV and $ARGV[0] eq '--ssh' and shift @ARGV; +if ($url =~ m@^ssh://(.*)$@) { + $Opt{ssh} = $1; +} +exec('ssh',$Opt{ssh},$NAME,@EXEC) if $Opt{ssh}; # # Distinct arg from key=value -- 2.47.3