bash envsubst - ghdrako/doc_snipets GitHub Wiki

Template, configuration, or initialization files keep the names of bash variables as placeholders.Thus, we need to fill in the variables’ values before actual use.

envsubst [OPTION] [SHELL-FORMAT]

Example

$ cat welcome.txt
Hello user $USER in $DESKTOP_SESSION. It's time to say $HELLO!
$ export HELLO="good morning"
$ envsubst < welcome.txt
Hello user joe in Lubuntu. It's time to say good morning!