Clone of envsubst. Supports parameter expansion.
envsubst-cli [VARIABLE] ... < INPUT > OUTPUT
I try to be true to the semantics of the original envsubst
which are slightly
different from the semantics in a shell. These differences include:
- Most "bad substitutions" are allowed
${}
->${}
${{foo}
->${{foo}
- Nested expansions are allowed:
export foo=bar ${${foo}}
->${bar}
- ...but they only expand at depth=1 ;p
Differences from the original envsubst
include:
- Shell builtin variables like
$$
and$0
are not supported - Unset variables throw an error by default (use
${parameter-}
or${parameter+}
to ignore unset variables) - Instead of using SHELL-FORMAT whitelisted variable names are passed as arguments
The following expansions are supported:
form | set and not null | set but null | unset |
---|---|---|---|
${parameter:-word} |
substitute parameter | substitute word | substitute word |
${parameter-word} |
substitute parameter | substitute null | substitute word |
${parameter:?[word]} |
substitute parameter | error, exit | error, exit |
${parameter?[word]} |
substitute parameter | substitute null | error, exit |
${parameter:+word} |
substitute word | substitute null | substitute null |
${parameter+word} |
substitute word | substitute word | substitute null |
chicken-install -test
- Escapes
- Inplace
- Add reference tests against envsubst
- Add --posix