On 11/15/25 7:42 PM, Emanuele Torre wrote:
On Sun, Nov 16, 2025 at 01:23:35AM +0100, Emanuele Torre wrote:
Normally "$@"/"${arr[@]}" on the RHS side of an assignment joins the
elements with ' ' even if IFS is set to a string with a first character
that is not space.

It has been pointed out to me that ${@#?} (and likewise %%.. %.. ##..)
also always uses IFS in this context, similarly to ${@@Q}:

     bash-5.3$ set aa bb cc; IFS=: o=${@#?}; declare -p o
     declare -- o="a:b:c"
     bash-5.3$ set aa bb cc; IFS=: o="${@#?}"; declare -p o
     declare -- o="a:b:c"

This is easy enough to fix; the pattern expansion operators didn't know
the expansion was taking place on the rhs of an assignment statement.

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

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to