Redirecting output to inline input (here) documents
You can redirect output to inline input (here) documents.
If a command is in the following form:
command << eofstring
and eofstring is any string
that does not contain pattern-matching characters, then the shell takes the
subsequent lines as the standard input of command until
the shell reads a line consisting of only eofstring (possibly
preceded by one or more tab characters). The lines between the first eofstring and
the second are frequently referred to as an inline input document,
or a here document. If a hyphen (-) immediately follows the <<
redirection
characters, the shell strips leading tab characters from each line of the here document
before it passes the line to command.
The
shell creates a temporary file containing the here document and performs
variable and command substitution on the contents before passing the file
to the command. It performs pattern matching on file names that are part of
command lines in command substitutions. To prohibit all substitutions, quote
any character of the eofstring:
command << \eofstring
The here document is especially useful for a small
amount of input data that is more conveniently placed in the shell procedure
rather than kept in a separate file (such as editor scripts). For example,
you could type the following:
cat <<- xyz
This message will be shown on the
display with leading tabs removed.
xyz