bug-bash
[Top][All Lists]
Advanced

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

Re: ksh style [[ conditional does not match patterns


From: Eric Blake
Subject: Re: ksh style [[ conditional does not match patterns
Date: Thu, 08 Dec 2005 19:45:53 -0700
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

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

According to Michael Wardle on 12/8/2005 7:22 PM:
> Yet when I attempt a simple match, it doesn't work:
> 
>     bash-3.00$ [[ "foo" == "foo" ]]
>     bash-3.00$ echo $?
>     0
>     bash-3.00$ [[ "foo" == "fo?" ]]
>     bash-3.00$ echo $?
>     1

Globbing (pattern matching) is suppressed by quotes.  Try removing the quotes:
$ [[ foo == fo? ]]
$ echo $?
0

However, there IS a bug here:
$ [[ foo == "fo?" ]]
$ echo ${PIPESTATUS[*]} $?
0 1

How come [[ didn't affect $PIPESTATUS?

$ echo ${BASH_VERSINFO[*]}
3 00 16 12 release i686-pc-cygwin

- --
Life is short - so eat dessert first!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDmO/h84KuGfSFAYARAhV3AJ44DHoYR760xDVWcmQpFalcqrT99gCdGfKH
slYOyaLZcq6mn8G5OYv1M1I=
=Hz7S
-----END PGP SIGNATURE-----




reply via email to

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