bug-bash
[Top][All Lists]
Advanced

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

Re: change in behavior starting with bash-4.3_p14 and $@ in [[...]]


From: Chet Ramey
Subject: Re: change in behavior starting with bash-4.3_p14 and $@ in [[...]]
Date: Wed, 13 Aug 2014 09:47:51 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 8/12/14, 11:05 PM, Mike Frysinger wrote:
> simple enough code:
> foo=(0 0 0); [[ -z address@hidden ]]; 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    address@hidden    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-----



reply via email to

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