Using here Documents
A here document is a block of code that you place into a script to perform a certain task. Yeah, I know, I said the same thing about functions. But, here documents are completely different. They’ve been around since the early days of Unix, and can be used in various different programming languages.
Formatting note: The accepted Unix and Linux convention for writing out the term “here document” is to do so in all lower-case letters. That can get a bit confusing, though. So, to eliminate the confusion, I’ll just italicize the term throughout the rest of this book, like this: here document.
Here documents work by providing another way to redirect input into a particular command. The code that performs this redirection is enclosed by a pair of limit strings, which look something like this:
command << _EOF_
. . .
Code to execute or data to display
. . .
_EOF_
The <<
sequence is a special type of redirector...