]> git.tuebingen.mpg.de Git - gsu.git/blobdiff - misc/gsu/config
gsu: Fix quoting of config default options.
[gsu.git] / misc / gsu / config
index e8d4471cc822e2ca90850482f9084084db70ce17..6edd502fec0a0fd29a0af3abb922e78bea80a464 100644 (file)
@@ -8,7 +8,7 @@ gsu_check_options()
 
        for ((i=0; i < ${#gsu_options[@]}; i++)); do
                eval "${gsu_options[$i]}"
-               eval val='"'\$$name'"'
+               eval val='"'\${${name}:-}'"'
                eval orig_${gsu_config_var_prefix}_$name='"'${val}'"'
        done
 
@@ -21,10 +21,8 @@ gsu_check_options()
 
                eval "${gsu_options[$i]}"
 
-
                # Check name. It must be non-empty and consist of [a-zA-Z_0-9]
                # only.  Moreover it must not start with [a-zA-Z].
-
                ret=-$E_GSU_BAD_CONFIG_VAR
                result="name: '$name'"
                # bash's =~ works only for 3.2 and newer, so use grep
@@ -33,7 +31,7 @@ gsu_check_options()
 
                eval orig_val='"'\$orig_${gsu_config_var_prefix}_$name'"'
                if [[ -z "$orig_val" ]]; then
-                       eval val='"'\$$name'"'
+                       eval val='"'\${$name:-}'"'
                else
                        val="$orig_val"
                fi
@@ -51,7 +49,7 @@ gsu_check_options()
                        return
                esac
 
-               eval ${gsu_config_var_prefix}_$name='"'\${val:=$default_value}'"'
+               eval ${gsu_config_var_prefix}_$name='"'\${val:="$default_value"}'"'
                # Check option type. ATM, only num and string are supported
                # Other types may be added without breaking compatibility
                case "$option_type" in