On 5/22/2022 10:39 PM, Sean Whitton wrote: > On Sun 22 May 2022 at 08:43pm -07, Jim Porter wrote: >> On 5/22/2022 8:34 PM, Jim Porter wrote: >>> Starting from `emacs -Q -f eshell', enter the following command: >>> >>>   echo ${*echo hi} | rev >>> >>> The output is: >>> >>>   ~ $ ih >>> >>> That is, the output of the command ended up *after* the prompt, when it >>> should be before. [snip] > > Couldn't you just defvar a couple of vars for this purpose? Do you mean just defvar-ing `headproc' and `tailproc' (and renaming them, of course)? That works for my example above, but falls apart for more complex cases such as: echo ${*echo hi | rev} | tr a-z A-Z The Eshell manual also says the following command is broken (output comes after the prompt). It works correctly with my patch, but just adding defvars isn't enough: for i in 1 2 3 { grep -q a b && *echo hi } | wc -l The "Command evaluation macros" comment section in lisp/eshell/esh-cmd.el indicates that there are some odd limitations on these macros, so that might be part of the issue. I'm still a bit confused as to why the dance in my patch is necessary, but I'm ok with any implementation that passes the tests. Attached is an updated patch with an additional test for the more-complex case and the manual entry about this bug removed.