From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17638 invoked by alias); 17 Oct 2011 21:29:14 -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: 16499 Received: (qmail 26464 invoked from network); 17 Oct 2011 21:29:11 -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 autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at dan.emsphone.com does not designate permitted sender hosts) Date: Mon, 17 Oct 2011 16:21:21 -0500 From: Dan Nelson To: "Daniel Serodio (lists)" Cc: zsh-users@zsh.org Subject: Re: What's wrong with this expression? Message-ID: <20111017212121.GB37547@dan.emsphone.com> References: <4E9C9997.3050306@mandic.com.br> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4E9C9997.3050306@mandic.com.br> X-OS: FreeBSD 8.2-STABLE User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: clamav-milter 0.97.2 at email2.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.6 (email2.allantgroup.com [199.67.51.78]); Mon, 17 Oct 2011 16:21:22 -0500 (CDT) X-Scanned-By: MIMEDefang 2.68 on 199.67.51.78 In the last episode (Oct 17), Daniel Serodio (lists) said: > 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: ~=" Try with =~ instead. Your line fails on bash as well: $ [[ "foo" ~= "x" ]] && echo true bash: conditional binary operator expected bash: syntax error near `~=' -- Dan Nelson dnelson@allantgroup.com