From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11177 invoked by alias); 17 Oct 2011 21:55:59 -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: 16504 Received: (qmail 3570 invoked from network); 17 Oct 2011 21:55:57 -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,HTML_MESSAGE, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at spf.mandic.com.br designates 200.225.81.151 as permitted sender) Message-ID: <4E9CA2D5.2040203@mandic.com.br> Date: Mon, 17 Oct 2011 19:49:09 -0200 From: "Daniel Serodio (lists)" User-Agent: Postbox 2.5.3 (Macintosh/20110907) MIME-Version: 1.0 To: Mikael Magnusson CC: zsh-users@zsh.org Subject: Re: What's wrong with this expression? References: <4E9C9997.3050306@mandic.com.br> <4E9C9DB4.50104@mandic.com.br> <4E9C9E99.7000208@mandic.com.br> In-Reply-To: Content-Type: multipart/alternative; boundary="------------090707070801010803070005" --------------090707070801010803070005 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Mikael Magnusson wrote: > On 17 October 2011 23:31, Daniel Serodio (lists) > wrote: >> Mikael Magnusson wrote: >> >> On 17 October 2011 23:27, Daniel Serodio (lists) >> wrote: >> >> Mikael Magnusson wrote: >> >> On 17 October 2011 23:09, Daniel Serodio (lists) >> wrote: >> >> I'm trying to troubleshoot a script that works with bash but fails with zsh, >> and it uses the "regex match" operator. What's wrong with this expression? >> >> [[ "foo" ~= "x" ]]&& echo true >> >> Fails with "zsh: condition expected: ~=" >> >> You wrote ~= instead of =~ >> >> Ooops. Error copy'n'pasting. The actual line in the script that fails is: >> >> if [[ ! "${PATH}" =~ $regex ]] ; then >> >> where "regexp" is: >> >> regex="^([^:]*:)*${rvm_bin_path}(:[^:]*)*$" >> >> Fails how? >> >> Sorry. Fails with "condition expected: =~" > > Maybe you don't have any regex module installed/loaded, does > -regex-match instead of =~ work? Hmmm, this seems to be the problem. [[ "foo" -regex-match "x" ]] && echo x fails with: zsh: unrecognized condition: `foo' --------------090707070801010803070005--