Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [[ 0 =~ 1 || 1 = 0 ]] returns true
- X-seq: zsh-workers 28336
- From: Michael Hwang <michael.a.hwang@xxxxxxxxx>
- To: Mikael Magnusson <mikachu@xxxxxxxxx>
- Subject: Re: [[ 0 =~ 1 || 1 = 0 ]] returns true
- Date: Sat, 9 Oct 2010 16:06:39 -0400
- Cc: zsh workers <zsh-workers@xxxxxxx>, brandon@xxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=CtZE/SpKm/fAGgB0IqUXudieoFyfiE0dlVSlCEIUMvo=; b=DQ9DC/NRjsJKNz2n8DOFgG1IOSs0DUHtOaonBwFU4AQxRB1/AgIKLV8RUwjH4mdtZb vklfCIwONgAYszhTeye/DVNAmx3XC3zHZ58pOeuRxapKGmII3tVcXCVd9x2SpVVKUNmR hJCbysrTPUrSM5xxkrmjx2ks1/a3NaeBo2XUg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=g9wSKZyWHbboIcGoSKTsy4VHqiGxfN6L+Di+qSDSu8EptKIpIOguTVbO3nXpeyLtZk O77K680Nd8fsBnIwSmadRjSXrd3HXiDwsjGk3HDxbHK4/5rv8mtgL7qSRM7z0VqeKu4J bcBqADEzyUuh9w8wqI8C/7TBhenLMpYrmZ+cE=
- In-reply-to: <AANLkTi=G-8Hro4iqv_cNorbRiJCxXt-XmFifeyBNwLof@xxxxxxxxxxxxxx>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <AANLkTi=G-8Hro4iqv_cNorbRiJCxXt-XmFifeyBNwLof@xxxxxxxxxxxxxx>
% set -x
% [[ 0 =~ 1 || 1 = 0 ]]
+zsh:2> [[ 0 -regex-match 1 || ! 1 == 0 ]]
% [[ 0 =~ 1 || 1 == 1 || 1 = 0 ]]
+zsh:3> [[ 0 -regex-match 1 || ! 1 == 1 ]]
% [[ 0 =~ 1 || 1 == 1 || 1 = 1 || 1 = 1 || 1 = 1 ]]
+zsh:4> [[ 0 -regex-match 1 || ! 1 == 1 ]]
It appears that zsh thinks it needs to invert the second conditional
expression. Also, zsh seems to drop more than two conditional
expressions.
Michael Hwang
On Sat, Oct 9, 2010 at 1:29 PM, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> % [[ 1 =~ 1 && 0 = 1 ]]; echo $?
> 0
> % [[ 1 =~ 1 || 0 = 1 ]]; echo $?
> 0
> % [[ 1 =~ 0 || 0 = 1 ]]; echo $?
> 0
> % [[ 1 =~ 0 || 1 = 1 ]]; echo $?
> 1
> % [[ 1 =~ 1 || 1 = 1 ]]; echo $?
> 0
> % [[ 1 =~ 1 && 1 = 1 ]]; echo $?
> 1
> % [[ 1 =~ 0 && 1 = 1 ]]; echo $?
> 1
>
> Something seems to be screwy with =~ and &&/||, on its own it appears fine.
>
> --
> Mikael Magnusson
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author