On 7/28/25 4:29 AM, Oğuz wrote:
On Sat, Jul 26, 2025 at 9:44 PM Greg Wooledge <g...@wooledge.org> wrote:
The quotation marks don't appear to matter, but
the trailing $ does.

`$!' works as well, when there's no most recent asynchronous job:

     $ printf '<%s>\n' $(seq 3)$!
     <1
     2
     3>
     $

I think the problem is right here:
https://cgit.git.savannah.gnu.org/cgit/bash.git/tree/subst.c?h=devel#n11524
The function `param_expand' writes 0 to `*expanded_something' when
`string' ends with `$' or `$!' and there's no async job, and bash
forgets all the expansions it has done in that word. Maybe it was
supposed to be called with the address of a local copy of
`expanded_something'? There's a variable named `local_expanded' in
that function that seems to be unused...

Good catch, that is the right approach.

Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to