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: MacBeth
Subject: Re: Heredoc with a multiline delimiter
Date: Sat, 15 Mar 2025 21:54:18 -0500

On Sat, Mar 15, 2025 at 8:18 PM Robert Elz <kre@munnari.oz.au> wrote:
>
> (line joining using \ isn't technically an escape sequence, but that
> detail is irrelevant here).
>

bash(1) claims it to be:

    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, with the
    exception of <newline>.  If a \<newline> pair appears, and the
    backslash is not itself quoted, the \<newline> is treated as a line
    continuation (that is, it is removed from the input stream and
    effectively ignored).

> POSIX says:
>
>         It is unspecified whether the line containing the trailing delimiter
>         is itself subject to this line continuation.
>
> which means that nothing is required to make that work.   Further, unless
> bash documents it as working, it is free to change the way it works for
> that at any time, so was anyone to take your advice and actually use that
> method, then they'd be risking their code breaking in a subsequent release,
> with perhaps no warning at all.
>
> kre
>

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. Perhaps the
documentation should be updated to reflect the fact that it may not
honor exceptional circumstances.



reply via email to

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