Subject: bug#12689: 24.2; Eshell ${cmd} substitution

From: Jim Porter <[email-masked]>
Date: Mon, 2 May 2022 20:52:03 -0700

On 2/9/2022 12:12 PM, Lars Ingebrigtsen wrote:
> OK; I'm reopening this bug report, then.

I filed bug#55236 to fix some wider issues I encountered with Eshell 
expansions, which may also fix this bug. I think it depends on what 
exactly we want for the behavior here. With my patches in that bug, this 
is the behavior I get:

Default:

   ~ $ echo ${/bin/echo -e "foo\nbar"}
   ("foo" "bar")
   ~ $ echo ${/bin/echo -e "foo\nbar"}-baz
   ("foo" "bar-baz")
   ~ $ /bin/echo ${/bin/echo -e "foo\nbar"}
   foo bar
   ~ $ /bin/echo ${/bin/echo -e "foo\nbar"}-baz
   foo bar-baz

With `eshell-plain-echo-behavior' == t:

   ~ $ echo ${*echo -e "foo\nbar"}
   foo bar
   ~ $ echo ${*echo -e "foo\nbar"}-baz
   foo bar-baz
   ~ $ /bin/echo ${/bin/echo -e "foo\nbar"}
   foo bar
   ~ $ /bin/echo ${/bin/echo -e "foo\nbar"}-baz
   foo bar-baz

I think the "plain" echo behavior is what the original report expected, 
so maybe we can consider this fixed then. However, maybe we should 
consider whether the default, non-"plain" behavior should be changed. I 
don't have a strong opinion here, although I'm hesitant to make any big 
changes to the default behavior of Eshell's echo builtin, since I feel 
like it could break a lot of things really easily...