~percona-toolkit-dev/percona-toolkit/fix-821715-enable-local-infile-in-dsn

« back to all changes in this revision

Viewing changes to lib/bash/parse_options.sh

Merge sh-not-bash-bug-1035260

Show diffs side-by-side

added added

removed removed

Lines of Context:
118
118
      echo
119
119
      echo "Options and values after processing arguments:"
120
120
      echo
121
 
      for opt in $(ls "$PO_DIR"); do
122
 
         local varname="OPT_$(echo "$opt" | tr a-z- A-Z_)"
123
 
         local varvalue="${!varname}"
124
 
         if ! grep -q "type:" "$PO_DIR/$opt" >/dev/null; then
125
 
            # Typeless option, like --version, so it's given/TRUE
126
 
            # or not given/FALSE.
127
 
            if [ "$varvalue" -a "$varvalue" = "yes" ];
128
 
               then varvalue="TRUE"
129
 
            else
130
 
               varvalue="FALSE"
 
121
      (
 
122
         cd "$PO_DIR"
 
123
         for opt in *; do
 
124
            local varname="OPT_$(echo "$opt" | tr a-z- A-Z_)"
 
125
            eval local varvalue=\$$varname
 
126
            if ! grep -q "type:" "$PO_DIR/$opt" >/dev/null; then
 
127
               # Typeless option, like --version, so it's given/TRUE
 
128
               # or not given/FALSE.
 
129
               if [ "$varvalue" -a "$varvalue" = "yes" ];
 
130
                  then varvalue="TRUE"
 
131
               else
 
132
                  varvalue="FALSE"
 
133
               fi
131
134
            fi
132
 
         fi
133
 
         printf -- "  --%-30s %s" "$opt" "${varvalue:-(No value)}"
134
 
         echo
135
 
      done
 
135
            printf -- "  --%-30s %s" "$opt" "${varvalue:-(No value)}"
 
136
            echo
 
137
         done
 
138
      )
136
139
      return 1
137
140
   fi
138
141
 
213
216
   fi
214
217
 
215
218
   # Finally, parse the command line.
216
 
   _parse_command_line "$@"
 
219
   _parse_command_line "${@:-""}"
217
220
}
218
221
 
219
222
_parse_pod() {
318
321
 
319
322
_parse_config_files() {
320
323
 
321
 
   for config_file in "$@"; do
 
324
   for config_file in "${@:-""}"; do
322
325
      # Next config file if this one doesn't exist.
323
326
      test -f "$config_file" || continue
324
327
 
377
380
   local required_arg=""
378
381
   local spec=""
379
382
 
380
 
   for opt in "$@"; do
 
383
   for opt in "${@:-""}"; do
381
384
      if [ "$opt" = "--" -o "$opt" = "----" ]; then
382
385
         HAVE_EXT_ARGV=1
383
386
         continue