[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 11:00:28 -0400

Also some expansions, like ${array[*]:num}, have an issue when the first
character of IFS is not whitespace:

   $ IFS=:; A=(1 2); a=${A[*]} b=${A[*]:0}; printf '<%s>' "$a" "$b"
   <1:2><1 2>

I put together a script (attached) to test the invariance of the interp 888
expansion rules under transformations of varying exoticness.  It produces
diff output that I think might help identifying/debugging such issues. Perhaps
some of it could be useful for the test suite.

   @@ -61,24 +61,20 @@ IFS=':'
    printf '%s\n' "${a[*]:0}"
    jkl:def ghi:abc
    var=${a[*]:0}; printf '%s\n' "$var"
   -jkl:def ghi:abc
   +jkl def ghi abc

Attachment: exp9_variations.sh
Description: Bourne shell script

reply via email to

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