0

I have printable text in a file (header.txt):

*******************
* $string
*******************

and I have the script (generate.sh):

prn_header () {
   string=$1
   echo $(<header.txt)
}

prn_header I_want_this_text_for_the_header

and the output is exactly the same like the header.txt.

My problem is: how can I get the template from a file, but substitute the needed variable in it before printing?

In real, I have many text pieces in files, and the result builded from them.

Tannis
  • 31
  • 1
  • 5

0 Answers0