Bash: Expanding variables and commands in text

Say you have a text file with variables or commands in it:

Store text file contents in a variable and expand variables and commands in the text with:

That’s it! You will see something like:

Note, that without  echo EOF bash will use first line of text as a limit string for heredoc.

Leave a Reply