[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: splitting/whitespace in expansions of ${*} vs ${*/}

From: Grisha Levit
Subject: Re: splitting/whitespace in expansions of ${*} vs ${*/}
Date: Thu, 30 Mar 2017 04:30:33 -0400

Sorry if you already noticed this: The latest devel push fixes the reported
field-splitting case but there is a regression with the fields getting
re-joined with spaces when performing an assignment:

   $ set -- 1 2; IFS=; a=$* b=${*/}; printf '<%s>' "$a" "$b"
   <12><1 2>

and with the expansion producing fields in the PE assignment case:

   $ set -- 1 2; IFS=; unset a b; printf '<%s>' ${a=$*} ${b=${*/}}

Also, upon closer inspection, I suspect the unset IFS case in my report is
actually an issue with the a=$* case and that b=${*/} behaves correctly
(aside from not matching the a=$* behavior).  The whitespace-trimming-when-
not-field-splitting thing is something that changed in bash-4.3:

   bash-4.2$ unset IFS; set ' '; a=$*; printf '<%s>' "$a"
   < >
   bash-4.3$ unset IFS; set ' '; a=$*; printf '<%s>' "$a"

Also also, the field-splitting issue is also present for arrays subscripted
with * when undergoing case modification or pattern substitution:

   $ A=(1 2); IFS=; printf '<%s>' ${A[*]} ${A[*]/}

reply via email to

[Prev in Thread] Current Thread [Next in Thread]