To me this is the easiest and most powerful solution, you can even include other templates using the command eval echo "$(<template.txt)
:
Example with nested template
- create the template files, the variables are in regular bash syntax
${VARIABLE_NAME}
or$VARIABLE_NAME
you have to escape special characters with
\
in your templates otherwhise they will be interpreted byeval
.
template.txt
Hello ${name}!