diff --git a/data/helpers.d/getopts b/data/helpers.d/getopts index 7055325f1..891fdaaeb 100644 --- a/data/helpers.d/getopts +++ b/data/helpers.d/getopts @@ -152,6 +152,8 @@ ynh_handle_getopts_args () { fi # Escape double quote to prevent any interpretation during the eval all_args[$i]="${all_args[$i]//\"/\\\"}" + # Escape $ as well to prevent the string following it to be seen as a variable. + all_args[$i]="${all_args[$i]//$/\\\$}" eval ${option_var}+=\"${all_args[$i]}\" shift_value=$(( shift_value + 1 )) @@ -193,6 +195,8 @@ ynh_handle_getopts_args () { # Escape double quote to prevent any interpretation during the eval arguments[$i]="${arguments[$i]//\"/\\\"}" + # Escape $ as well to prevent the string following it to be seen as a variable. + all_args[$i]="${all_args[$i]//$/\\\$}" # Store each value given as argument in the corresponding variable # The values will be stored in the same order than $args_array