zsh-workers
 help / color / mirror / code / Atom feed
From: Michael Hwang <michael.a.hwang@gmail.com>
To: Mikael Magnusson <mikachu@gmail.com>
Cc: zsh workers <zsh-workers@zsh.org>, brandon@ifup.org
Subject: Re: [[ 0 =~ 1 || 1 = 0 ]] returns true
Date: Sat, 9 Oct 2010 16:06:39 -0400	[thread overview]
Message-ID: <AANLkTim6KnxvKXbJmUQrUqm+mCBMU=y2maB0PitOfBfC@mail.gmail.com> (raw)
In-Reply-To: <AANLkTi=G-8Hro4iqv_cNorbRiJCxXt-XmFifeyBNwLof@mail.gmail.com>

% 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@gmail.com> 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
>


  reply	other threads:[~2010-10-09 20:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-09 17:29 Mikael Magnusson
2010-10-09 20:06 ` Michael Hwang [this message]
2010-10-09 22:17   ` Phil Pennock
2010-11-02 16:34     ` Brandon Philips
2010-11-02 20:41       ` Mikael Magnusson
2010-11-02 23:37       ` Phil Pennock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTim6KnxvKXbJmUQrUqm+mCBMU=y2maB0PitOfBfC@mail.gmail.com' \
    --to=michael.a.hwang@gmail.com \
    --cc=brandon@ifup.org \
    --cc=mikachu@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).