help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Format of here-documents


From: Andreas Kusalananda Kähäri
Subject: Re: Format of here-documents
Date: Tue, 14 Mar 2023 15:28:42 +0100

On Tue, Mar 14, 2023 at 11:58:16AM +0000, goncholden via wrote:
> Have been reading the manual about Here-Documents.
> 
> The format of here-documents is:
> 
> [
> 
> n
> 
> ]<<[-]
> 
> word
> 
> here-document
> 
> delimiter
> 
> But in practice I have seen the following
> 
> cat << _end_of_text
> First Line
> Second Line
> Third Line
> _end_of_text
> 
> Meaning that 'delimiter' is actually '
> 
> word'.  Is this correct ?

>From the bash manual:

        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 expanded.

Assumign that your issue with the manual is that the displayed syntax
for here-documents does *not* say

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

... the quoted sentence above should explain why the "word" and
"delimiter" may be different (they would be if "word" is quoted in any
way).


-- 
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden

.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]