-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 8/12/14, 11:05 PM, Mike Frysinger wrote:
> simple enough code:
> foo=(0 0 0); [[ -z ${foo[@]#0} ]]; echo $?
>
> with bash-4.3_p13 and older, this would show 0. starting with bash-4.3_p14,
> this now shows 1.
It's intentional, and part of the same bug fix. Word splitting is
suppressed inside [[, so the array expands to a single word ("0 0 0"), the
0s are removed, leaving " ", and that is the result the current version
uses. The code before patch 14 ran the string through word splitting,
which removed the spaces. FWIW, ksh93 returns the same result as the
patched bash, though I can't tell whether it's doing the exact same thing
internally.
Chet
- --
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iEYEARECAAYFAlPrbIcACgkQu1hp8GTqdKtKBwCeJrFBvXyzXEzL/HABKzS1ZS/x
32sAn3PEPcEPfUuTRXCHPT+KLWimMJsf
=T5NC
-----END PGP SIGNATURE-----