diff --git a/data/helpers.d/utils b/data/helpers.d/utils index 70643c64a..62d7b0c0b 100644 --- a/data/helpers.d/utils +++ b/data/helpers.d/utils @@ -393,7 +393,8 @@ ynh_replace_vars () { for one_var in "${uniques_vars[@]}" do # Validate that one_var is indeed defined - test -n "${!one_var:-}" || ynh_die --message="\$$one_var wasn't initialized when trying to replace __${one_var^^}__ in $file" + # Explanation for the weird '+x' syntax: https://stackoverflow.com/a/13864829 + test -n "${one_var+x}" || ynh_die --message="Variable \$$one_var wasn't initialized when trying to replace __${one_var^^}__ in $file" # Escape delimiter in match/replace string match_string="__${one_var^^}__"