CHAPTER 9 Shell Programming
The following scripts illustrate this,
for the Bourne shell: and for the C shell:
#!/bin/sh #!/bin/csh -f
does=does set does = does
not="" set not = ""
cat << EOF cat << EOF
This here document This here document
$does $not $does $not
do variable substitution do variable substitution
EOF EOF
cat << \EOF cat << \EOF
This here document This here document
$does $not $does $not
do variable substitution do variable substitution
EOF \EOF
Both produce the output:
This here document
does
do variable substitution
This here document
$does $not
do variable substitution
In the top part of the example the shell variables $does and $not are substituted. In the bottom part they are treated as simple text strings without substitution.