From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17650 invoked by alias); 7 Mar 2012 09:21:53 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16856 Received: (qmail 23914 invoked from network); 7 Mar 2012 09:21:51 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at math.technion.ac.il does not designate permitted sender hosts) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAPYnV0+ERHMG/2dsb2JhbABDtQ2BB4F+AQU6Pw4CCw44FAcRMROIB7omBJAJYwSVPgGQFoJl X-IronPort-AV: E=Sophos;i="4.73,545,1325455200"; d="scan'208";a="82113763" Date: Wed, 7 Mar 2012 11:21:45 +0200 From: Nadav Har'El To: Mikael Magnusson Cc: Peter Stephenson , zsh-users@zsh.org Subject: Re: [[ and [ Message-ID: <20120307092145.GA27660@fermat.math.technion.ac.il> References: <4F52D510.6000002@sergio.spb.ru> <120303202448.ZM21278@torch.brasslantern.com> <4F555B0B.1050401@sergio.spb.ru> <120305220555.ZM27709@torch.brasslantern.com> <4F55EF85.3050809@sergio.spb.ru> <20120306113532.789859ca@pwslap01u.europe.root.pri> <20120306114404.359e1c9d@pwslap01u.europe.root.pri> <20120307090216.GD15125@fermat.math.technion.ac.il> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-12-10) On Wed, Mar 07, 2012, Mikael Magnusson wrote about "Re: [[ and [": > > On Tue, Mar 06, 2012, Mikael Magnusson wrote about "Re: [[ and [": > >> Incidentally, this is probably the most confusing error message ever, > >> % [ $foo == "" ] > >> zsh: = not found > > > > I see something slightly different. On zsh 4.3.15, with unset $foo, I >.. > You need to not have done unsetopt equals to see the confusing one :). Wow, it's not just EQUALS (which I do have set, and use it all the time), it's also the NOMATCH option which I forgot was the default. I've mentioned this in the past that I think that NONOMATCH should be the default... With NONOMATCH, I get: $ echo =ls /bin/ls $ echo =dog =dog $ echo == == $ [ a == a ] && echo success success which is exactly what I would expect. With the (unfortunately default) NOMATCH, I get: $ echo =ls /bin/ls $ echo =dog zsh: dog not found $ echo == zsh: = not found $ [ a == a ] && echo success zsh: = not found So the confusing error doesn't come from [, it comes from NOMATCH, which (did I say that? :-)) I really don't like being the default. One thing to note, though, is that the traditional equality operator for test (or '[') was "=", not "==", so had you used =, you would not have this problem in the first place... -- Nadav Har'El | Wednesday, Mar 7 2012, nyh@math.technion.ac.il |----------------------------------------- Phone +972-523-790466, ICQ 13349191 |Topologist, n.: A person who cannot tell http://nadav.harel.org.il |a doughnut from a coffee mug.