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 18:08:48 -0500

On Sat, Mar 15, 2025 at 12:33 PM Greg Wooledge <greg@wooledge.org> wrote:
> On Sat, Mar 15, 2025 at 16:14:00 +0000, Nikola Novak via Bug reports for the 
> GNU Bourne Again SHell wrote:
> > How do you end the heredoc with a multiline delimiter such as the following:
> >
> > cat << "a
> > b"
>
> You don't.
>

However you could fake it, by including backslashes in the delimiter,
which would allow literal newlines, but bash would ignore them as they
are escape sequences. So they wouldn't actually be a part of the
delimiter from bash's perspective, but merely visually and accepted
from the literal input.

$ cat <<EOT\
$ EOF
$ hello
$ goodbye
$ EOT\
$ EOF
hello
goodbye
$



reply via email to

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