Advertisement

Using Here Documents in Linux
Administration Note

cat <<EOF>/tmp/newfile
This is the contents of the here document
It can span multiple lines
A here document says to take all of this text up to the terminating
characters (which in this case are the characters E as in edward
O as in October, and F as in Frank. I would have chosen any character
string I wanted to. As soon as the script sees the characters I
choose together it will then terminate creating the here document.
Note that I am taking all this text and saving it in the document
called /tmp/newfile. That's all I have for now, the next line
will contain the magical 3 characters:
EOF

#now you can use the new file however you need:
cat /tmp/newfile