On 1/22/21 11:54 AM, Oğuz wrote:

Since everyone's making feature requests here, it'd be a shame if I didn't
participate. I think it'd be better if `${assoc[@]@K}' expanded to a word
list instead of a single word.

It does, when it's subject to word splitting. In contexts where no word
splitting takes place, it expands to a single word, since it's supposed to
parallel the `A' transformation. I agree that it might be more useful if it
expanded to multiple words in contexts like

copy=( "${assoc[@]@K}" )

And, having ampersand as a reference for the
matched substring in the replacement part of `${param/pat/rep}` would also
be good.

There has been code to do this for a long time. It's currently tagged for
bash-5.2. If you want to play around with it, look in subst.c for shouldexp_replacement and its caller, and uncomment them. You'll have to
wait for the next devel branch push for a version that works with multibyte
characters -- that should tell you how long it's been there.

--
``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/

Reply via email to