Assuming I have a variable v="c d e f g" and a file with the content:
line1
$v
line3
How can I make a bash script print this file with the content of the variable in line 2 as if I was using a here-document like this:
#!/bin/bash
v="c d e f g"
cat << EOF
line1
$v
line3
EOF
Output:
line1
c d e f g
line3