envsubst Command Examples

Substitutes environment variables with their value in shell format strings. Variables to be replaced should be in either ${var} or $var format. More information: https://www.gnu.org/software/gettext/manual/html_node/envsubst-Invocation.html.

echo '{{$HOME}}' | envsubst

envsubst < {{path/to/input_file}}

envsubst < {{path/to/input_file}} > {{path/to/output_file}}

envsubst '{{$USER $SHELL $HOME}}' < {{path/to/input_file}}