help-bash
[Top][All Lists]
Advanced

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

Re: here document within $()


From: Alejandro Colomar
Subject: Re: here document within $()
Date: Wed, 7 Oct 2026 21:16:55 +0200

Hi Greg,

> Date: 2026-10-07 08:26:30-0400
> From: Greg Wooledge <greg@wooledge.org>
>
> On Wed, Oct 07, 2026 at 09:51:01 +0200, Alejandro Colomar wrote:
> > I'm trying to have a here document used within $() which itself is
> > passed to eval(1).
> 
> *Shudder*
> 
> > Here's a minimal example of what I want:
> > 
> >     eval $(cat <<'__EOF__');
> >     echo foo;
> >     __EOF__
> 
> The closing parenthesis has to be after the __EOF__, on a new line.
> 
> eval $(cat <<'__EOF__'
> echo foo
> __EOF__
> )
> 
> I have *no idea* how eval is going to interact with all that, so it's
> all on you.

Hmmm, for the trivial example, it seems to work, but for my real case it
seems it doesn't.  I've decided to first write to a file, then eval the
cat of the file.

Thanks for the help!


Have a lovely night!
Alex

-- 
<https://www.alejandro-colomar.es>

Attachment: signature.asc
Description: PGP signature


reply via email to

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