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: microsuxx
Subject: Re: Heredoc with a multiline delimiter
Date: Sun, 16 Mar 2025 00:54:02 +0100

++

On Sun, Mar 16, 2025, 12:10 AM MacBeth <macbeth.112358@gmail.com> wrote:

> 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]