Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [[ and [
On Tue, 6 Mar 2012 11:35:32 +0000
Peter Stephenson <Peter.Stephenson@xxxxxxx> wrote:
> However,
>
> [[ $foo -eq "" ]]
>
> does exactly what it looks like it does
Sigh. Sort of. [ ... -eq ...] and [[ ... -eq ... ]] are numeric tests,
so if foo is a string of zeros it's not doing what it looks like. I
should have said
[ $foo = "" ]]
and
[[ $foo = "" ]]
or
[[ $foo == "" ]]
I don't know why it's that way round, it seems a bit illogical (which is
why Perl is the other way), but it always has been that way.
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
Messages sorted by:
Reverse Date,
Date,
Thread,
Author