set -- '' '' '' echo "*->${*}<-" echo "->${*// /}<-"
set -- '' '' ''
IFS='' echo "IFS=''->${*}<-"
set -- '' '' '' IFS= echo "IFS=->${*}<-" ============================ address@hidden ycc# ./tst abc-> <-
-><- *-> <- -> <- IFS=''-> <- IFS=-> <- ============================ When abc contains 2 spaces, I can replace them and get a null string with the pattern substitution.
When I replace the abc with *, it no longer works as is evidenced by the tests.
I have a case where I have from 1 to 3 passed parameters. They could all be null strings. What I wanted to do is use * to aggregate all the passed parameters, knowing that they would be separated by the 1st char of IFS - a space. If all the parms are null strings, this would produce a null string for only 1 parm, a single space for 2 parms and 2 spaces for 3 parms. Using simple substitution of all spaces to null would tell me that all the parms were null.
Alternatively setting IFS='' when evaluating the ${*} should also produce a null string. It doesn't.
I don't see where this is clever or tricky code. Its a simple substitution. What else would * be good for if not to aggregate all the parms and then do something with the aggregation?