Replace environment variables in an input file and output to stdout

envsubst

  • 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>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

envsubst < {{path/to/input_file}}

click the source code to copy install envsubst on any operating system with command-not-found.com