From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3578 invoked by alias); 7 Mar 2011 09:29:18 -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: 15839 Received: (qmail 28350 invoked from network); 7 Mar 2011 09:29:17 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at bewatermyfriend.org does not designate permitted sender hosts) From: Frank Terbeck To: Lyre <4179e1@gmail.com> Cc: zsh-users@zsh.org Subject: Re: string equal problem In-Reply-To: <87oc5n9tt4.fsf@ft.bewatermyfriend.org> (Frank Terbeck's message of "Mon, 07 Mar 2011 10:13:59 +0100") References: <87oc5n9tt4.fsf@ft.bewatermyfriend.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Date: Mon, 07 Mar 2011 10:27:19 +0100 Message-ID: <87k4gb9t6w.fsf@ft.bewatermyfriend.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Df-Sender: 430444 Frank Terbeck wrote: > Lyre wrote: >> To my surprise=EF=BC=8Cthe following statment: >> >> if [ "abc" =3D=3D "def" ]; then echo y; else echo n; fi >> >> doesn't work, it says "zsh: =3D not found". > > `=3D=3D' only works in "[[ ... ]]". [...] Actually, that's not quite true. `[' works like a command, thus =3D=3D is seen like it is for any other command too. And in those cases, the leading equal leads to expansion of the corresponding program's full path. For example zsh% print =3Demacs /usr/bin/emacs Now, there is no command "=3D" on your system, which is why you're getting the correct message "=3D not found". To prevent this, you can either unset the `EQUALS' option (man zshoptions | less -p EQUALS) or quote the string that is otherwise subject to this expansion. As in: if [ 'abc' '=3D=3D' 'def' ]; then Regards, Frank --=20 In protocol design, perfection has been reached not when there is nothing left to add, but when there is nothing left to take away. -- RFC 1925