substitute(): --subst-var was silently coercing to "" if the variable does not exist.

This commit is contained in:
volth 2018-07-08 15:59:57 +00:00
parent 4bd4e3ef5c
commit 0de0ce5893

View File

@ -661,6 +661,10 @@ substituteStream() {
echo "substituteStream(): ERROR: substitution variables must be valid Bash names, \"$varName\" isn't." >&2
return 1
fi
if [ -z ${!varName+x} ]; then
echo "substituteStream(): ERROR: variable \$$varName is unset" >&2
return 1
fi
pattern="@$varName@"
replacement="${!varName}"
;;