Use non-Bashism indirect reference in parse_options. Change $@ to ${@:-} and update parse_options in all tools.

This commit is contained in:
Daniel Nichter
2012-08-14 11:46:47 -06:00
parent 9ddf90eeca
commit 3602bb252f
6 changed files with 87 additions and 72 deletions

View File

@@ -121,19 +121,22 @@ usage_or_errors() {
echo
echo "Options and values after processing arguments:"
echo
for opt in $(ls "$PO_DIR"); do
local varname="OPT_$(echo "$opt" | tr a-z- A-Z_)"
local varvalue="${!varname}"
if ! grep -q "type:" "$PO_DIR/$opt" >/dev/null; then
if [ "$varvalue" -a "$varvalue" = "yes" ];
then varvalue="TRUE"
else
varvalue="FALSE"
(
cd "$PO_DIR"
for opt in *; do
local varname="OPT_$(echo "$opt" | tr a-z- A-Z_)"
eval local varvalue=\$$varname
if ! grep -q "type:" "$PO_DIR/$opt" >/dev/null; then
if [ "$varvalue" -a "$varvalue" = "yes" ];
then varvalue="TRUE"
else
varvalue="FALSE"
fi
fi
fi
printf -- " --%-30s %s" "$opt" "${varvalue:-(No value)}"
echo
done
printf -- " --%-30s %s" "$opt" "${varvalue:-(No value)}"
echo
done
)
return 1
fi