bug-bash
[Top][All Lists]
Advanced

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

Re: Heredoc with a multiline delimiter


From: Robert Elz
Subject: Re: Heredoc with a multiline delimiter
Date: Sun, 16 Mar 2025 13:11:49 +0700

    Date:        Sat, 15 Mar 2025 21:54:18 -0500
    From:        MacBeth <macbeth.112358@gmail.com>
    Message-ID:  
<CAGp4WjwDV8i+55+6rsMEUxSqf4UVPPHxR+hvWPVA8_gN4BoEpA@mail.gmail.com>

  | bash(1) claims it to be:

Actually, I don't think it does,

  |     There are three quoting mechanisms: the escape character, single
  |     quotes, and double quotes.
  |
  |     A non-quoted backslash (\) is the escape character.  It preserves
  |     the literal value of the next character that follows,

That is \ being the escape char.

  |     with the exception of <newline>.

And that's the exception, when \ isn't the escape char,

  |     the \<newline> is treated as a line continuation

it is that instead.    But this is just terminology, what we
call it makes no difference, it does what it does.

  | I do not see any exceptional circumstances in the above description of
  | line continuation in bash(1), which implies there are none, which
  | implies it is stating "it as working", without exception.

There aren't any exceptions in general, line continuation applies
everywhere an unquoted (or double quoted) including in here-docs
with an unquoted delimiter word in the operator.

The question is whether that is done before or after the end delimiter
is tested when reading the here doc, which POSIX says is unspecified, and
the bash doc says nothing about at all.

kre





reply via email to

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