in reply to sudo ignoring string entry after first space encountered

I'm unable to duplicate your problem. Could you post a short but complete script that demonstrates the issue?

  • Comment on Re: sudo ignoring string entry after first space encountered

Replies are listed 'Best First'.
Re^2: sudo ignoring string entry after first space encountered
by perl197 (Novice) on Apr 14, 2015 at 23:17 UTC

    Hi, I'm not sure an apples to apples example is possible in print. I have sudu set up as an alias (alias sudu='sudo -H -u prodaccount SudoENV.ksh where SuoENV.ksh is a bash shell script that references the prodaccount environment variables. Actual command line example; sudu optim_table.pl -i ab_in_keys_201504 -ic NZMDSODS -n 1000 -o work_cal_123 -oc NZMDSODS -u clough -w "track_seq in ('Z010201503052014871','Z0102015030520148710')" .pl snippets

    GetOptions ("i=s" => \$input_tbl, "ic=s" => \$input_con_str, ## defaults to +"nzmdsods" "o=s" => \$output_tbl, ## defaults to +"${input_tbl}" "oc=s" => \$output_con_str, ## defaults to +"nzmdsods" "u=s" => \$user, "k=s" => \$key, ## defaults to +"rowid" "w=s" => \$where_condition, ## defaults to +"1=1" "n=i" => \$rec_count, ## defaults to +1000 "cfg=s" => \$config_file, ## defaults to +same name as report file; if specified, overrides pii class mapping "ld=s" => \$log_dir ## defaults to +"/Projects/OPScripts/MDS/logs" ); ..... print "CED WHERE CONDITION $where_condition\n"; $where_condition = "1=1" if (!$where_condition); $where_clause = "where $where_condition"; print "CED WHERE CLAUSE $where_clause\n";
    result: CED WHERE CONDITION track_seq CED WHERE CLAUSE track_seq expected: CED WHERE CONDITION track_seq in ('Z010201503052014','Z010201503052014') CED WHERE CONDITION track_seq in ('Z010201503052014','Z010201503052014') This may not be a perl issue per se and more of a shell issue. I'm hoping the symptoms described will foster some thoughts/tricks on how to rectify the quirk.

      where SuoENV.ksh is a bash shell script

      So are you using $* in your script where you should be using "$@" ?

      $ cat wrapper #!/bin/bash perl -le'print for @ARGV' $* perl -le'print for @ARGV' "$@" $ ./wrapper foo "a b c" foo a b c foo a b c

      - tye        

        Thank-you much for your response(s). In theory this should address the symptom and had been recommened from other quarters. However it was to no avail. I changed the script to read the where clause from a file, rather than command line entry, which gets me over the hump for the time being. I'm still in persuit of a pure solution as I suspect this will crop up again.