cat <<EOF > test
My name is $NAME
EOF
ou até mesmo
cat <<==end > test
My name is $NAME
==end
Trabalhei para mim.
Parece que quando você pega ==end
na variável '
não substitui.
ah, aqui está na página do manual (veja 3.6.6) :
The format of here-documents is:
<<[-]word here-document delimiter
No parameter expansion, command substitution, arithmetic expansion, or pathname expansion is performed on word. If any characters in word are quoted, the delimiter is the result of quote removal on word, and the lines in the here-document are not expanded. If word is unquoted, all lines of the here-document are subjected to parameter expansion, command substitution, and arithmetic expansion. [...]