From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6973 invoked by alias); 6 Mar 2012 16:29:27 -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: 16847 Received: (qmail 13116 invoked from network); 6 Mar 2012 16:29:26 -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, SPF_HELO_PASS autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Tue, 6 Mar 2012 16:29:16 +0000 From: Peter Stephenson To: Subject: Re: [[ and [ Message-ID: <20120306162916.50c71829@pwslap01u.europe.root.pri> In-Reply-To: <4F563860.2040506@sergio.spb.ru> 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> <4F563860.2040506@sergio.spb.ru> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.101.10.170] X-Scanned-By: MailControl 7.6.6 (www.mailcontrol.com) on 10.71.0.139 On Tue, 6 Mar 2012 20:16:32 +0400 sergio wrote: > than you for a good explanation. Hope you'll add it to the manual. Actually, the description of test and [ already has this to say... test [ arg ... ] [ [ arg ... ] ] Like the system version of test. Added for compatibility; use conditional expressions instead (see the section `Conditional Expressions'). The main differences between the conditional expression syntax and the test and [ builtins are: these com=E2= =80=90 mands are not handled syntactically, so for example an empty variable expansion may cause an argument to be omitted; syntax errors cause status 2 to be returned instead of a shell error; and arithmetic operators expect integer arguments rather than arithmetic expressions. The command attempts to implement POSIX and its extensions where these are specified. Unfortunately there are intrinsic ambigui=E2= =80=90 ties in the syntax; in particular there is no distinction between test operators and strings that resemble them. The standard attempts to resolve these for small numbers of argu=E2= =80=90 ments (up to four); for five or more arguments compatibility cannot be relied on. Users are urged wherever possible to use the `[[' test syntax which does not have these ambiguities. --=20 Peter Stephenson 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, Cambr= idge 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