help-bash
[Top][All Lists]
Advanced

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

Re: Format of here-documents


From: goncholden
Subject: Re: Format of here-documents
Date: Tue, 14 Mar 2023 15:09:06 +0000





Sent with Proton Mail secure email.

------- Original Message -------
On Wednesday, March 15th, 2023 at 3:01 AM, goncholden 
<goncholden@protonmail.com> wrote:


> 
> 
> 
> 
> 
> Sent with Proton Mail secure email.
> 
> 
> ------- Original Message -------
> On Wednesday, March 15th, 2023 at 2:28 AM, Andreas Kusalananda Kähäri 
> andreas.kahari@abc.se wrote:
> 
> 
> 
> > 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).

The start sentence is incorrect because the ending line must be DELIMITER, not 
WORD.

This type of redirection instructs the shell to read input from the current 
source until a line containing only word (with no trailing blanks) is seen. 

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



reply via email to

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