[n]<<[-]word
               here-document
       delimiter

The shell does not perform parameter and variable  expansion,  com‐
mand  substitution,  arithmetic expansion, or pathname expansion on
word.

If any part of word is quoted, the delimiter is the result of quote
removal  on  word,  and  the lines in the here-document are not ex‐
panded.


         If word is unquoted, the delimiter is word itself, and the
here-document  text is treated similarly to a double-quoted string:
all lines of the here-document are subjected  to  parameter  expan‐
sion, command substitution, and arithmetic expansion, the character
sequence \<newline> is treated literally
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is false. Backslash-newline is treated literally only in
<<"EOF" heredocs. In <<EOF heredocs, it is removed
(it's a line continuation).


                                        , and \  must  be  used  to
quote  the characters \, $, and `; however, double quote characters
have no special meaning.

If the redirection operator is <<-, then the shell strips all lead‐
ing  tab characters from input lines and the line containing delim‐
iter.  This allows here-documents within shell scripts  to  be  in‐
dented in a natural fashion.



If  the delimiter is not quoted, the \<newline> sequence is treated
as a line continuation: the two lines are joined and the backslash-
newline  is removed.  This happens while reading the here-document,
before the check for the ending delimiter, so joined lines can form
the end delimiter.
^^^^^^^^^^^^^^^^^^^^^^^
Here the description is correct. Not sure why the explanation
how backslash-newline behaves is repeated twice.


Reply via email to