In gsu_check_options() we declare the six option variables (name,
option_type, ...) local to avoid overwriting the content of
user-defined variables of the same name.
Of course this only works if the variables are declared local before
we assign to them. This is currently not the case because the
eval "${gsu_options[$i]}"
statement in the first loop sets these variables before they are
declared in the body of the second loop.
This bug is benign since gsu_check_options() is usually called before
any command handler is executed. Let's fix it anyway.
# file.
gsu_check_options()
{
- local i conf="${gsu_config_file:=${HOME:-}/.$gsu_name.rc}" val
+ local i conf="${gsu_config_file:=${HOME:-}/.$gsu_name.rc}" val orig_val
+ local name option_type default_value required description help_text
for ((i=0; i < ${#gsu_options[@]}; i++)); do
eval "${gsu_options[$i]}"
[[ -r "$conf" ]] && source "$conf"
for ((i=0; i < ${#gsu_options[@]}; i++)); do
- local name= option_type= default_value= required=
- local description= help_text=
- local val orig_val
+ name=
+ option_type=
+ default_value=
+ required=
+ description=
+ help_text=
eval "${gsu_options[$i]}"