Fix ynh_replace_vars in case var is define but empty

This commit is contained in:
Alexandre Aubin 2021-01-09 23:57:09 +01:00
parent 6f2b9e12a4
commit 30dde208dc

View file

@ -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^^}__"