From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29045 invoked by alias); 19 Sep 2014 10:02:44 -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: 19111 Received: (qmail 5943 invoked from network); 19 Sep 2014 10:02:43 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=MPXHS+0JsHC/sXrgqM9PBkjFJaqDRszl6GJhGNHMPI8=; b=GLSX1Mb9J8aok3jCI6UVSLRCymFiX5yTpTgpFNIelzxGeHndrcH3l4UX2JVqKvEH/G hfaKtyMrlXQsiHp9qNlc0nDdJVpEfM6KdLsSsfIrjk23ccQkrzGdbgAzuUjg68X6p5hB annLH0LLw3rAtkWx+cLlKH3C+ezyvradAK91RzUDrfB/WpHHP0envBPoq1IpiTrR3csw FgLl7ASedTqrUQltY/66pl7ME+4JnBsS3MUgKHn3rQaLIzAAGhluRuiFLoOlUjZ3SnoY XfRz6WS2gzBTOTm+AYRiQVGl7mMXUmq8GxHXb7YDENL7lxjwRdxwTe9VDytc5HZKnMga ls7A== X-Gm-Message-State: ALoCoQlX3hFnQsSUJwxofdS8tTjecaXn8/n9FDzgMq1MGNW8lJjqpkhF8jbCCfxnagXA1fUBkbfD MIME-Version: 1.0 X-Received: by 10.152.45.8 with SMTP id i8mr5592859lam.31.1411120961223; Fri, 19 Sep 2014 03:02:41 -0700 (PDT) X-Originating-IP: [82.132.214.242] In-Reply-To: <20140919080426.GA4265@localhost.localdomain> References: <20140919080426.GA4265@localhost.localdomain> Date: Fri, 19 Sep 2014 11:02:41 +0100 Message-ID: Subject: negative pattern doesn't match empty string in globbing? From: Peter Stephenson To: "zsh-users@zsh.org" Content-Type: multipart/alternative; boundary=001a11c1ba20a10eda0503683305 --001a11c1ba20a10eda0503683305 Content-Type: text/plain; charset=UTF-8 On Friday, 19 September 2014, Han Pingtian > wrote: > Hello, > > I just notice that negative pattern like this doesn't work: > > localhost% setopt extendedglob > localhost% print /usr/**/bin/zsh > /usr/bin/zsh /usr/local/bin/zsh > localhost% print /usr/^local/bin/zsh > zsh: no matches found: /usr/^local/bin/zsh > localhost% ls /usr//bin/zsh > /usr//bin/zsh > localhost% > > I think if "^local" can match with empty string, then this should work. > But looks like it doesn't. Please excuse formatting, I'm writing this on a phone on a bus and have encountered a catalogue of problems... Negative pattern matches are confusing. Think about them as "match anything but..." In other words, first match something, then decide what to exclude. In this case the matches are all the files in the directory (and not the empty string). So the overall match fails when you try to exclude everything. (The keyboard's completion keeps offering 'Scotland'. Must turn off trending phrases.) Hope for a mobile cell soon... pws --001a11c1ba20a10eda0503683305--