-
Notifications
You must be signed in to change notification settings - Fork 109
Open
Description
In envsubst, it appears like ${parameter:+word}, ${parameter:=word} and ${parameter:?word} are all treated as if they were${parameter:-word}. According to the README, + and ? are unsupported, but I would expect an error instead of this behaviour.
From the bash reference manual:
${parameter:-word}: If parameter is unset or null, the expansion of word is substituted. Otherwise, the value of parameter is substituted.${parameter:=word}: If parameter is unset or null, the expansion of word is assigned to parameter. The value of parameter is then substituted. Positional parameters and special parameters may not be assigned to in this way.${parameter:?word}: If parameter is null or unset, the expansion of word (or a message to that effect if word is not present) is written to the standard error and the shell, if it is not interactive, exits. Otherwise, the value of parameter is substituted.${parameter:+word}: If parameter is null or unset, nothing is substituted, otherwise the expansion of word is substituted.
= and - are quite similar, and will function as expected in most use cases.
? should not substitute anything, but error if unset.
+ currently does the exact opposite of what it's supposed to do.
Metadata
Metadata
Assignees
Labels
No labels