From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17979 invoked by alias); 19 Sep 2014 09:55:20 -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: 19110 Received: (qmail 15722 invoked from network); 19 Sep 2014 09:55:08 -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=t7Ch98agyGT9IsmY4jxt7dVQ40042XOtQJ8qN5Lx/4E=; b=Y55G6O1OgMoG5Fj0qvkDw8TiLU1d6Fr0Q69rVdE7F9F3bFYVXSUnwQ+5ajK116aqs9 +HbC7luWq3QCnya2//VkF9ORqc3BQyKCbxVpdW+djoKXfBYGePrHOat+1Zo8tdy1Q00F S/ZQ2Ltq7+XJWPsjfihWWYE6Nuvp6iFlJooWufG/S9BUwGC723SzCaDYQWhamZ/aUHL8 9fb0i+y0HB0r80frmuuHRQvpQZMhHvDQEpRz/MKHsJzj5YCstI6ZP0XAkvdkqA85lwNu VL7JJPGbeOrZ6HcV5hgLgOhESgXf+P6nFt6GOwXQKkukgLwC8xyD4aFgKtV+Y8q0LJ8j 6irA== X-Gm-Message-State: ALoCoQk2BC7BbpJqshAtlVGjtz0tTvCAdKHqbvQoSTtj+Ka0kvRFNGhGxrthSj2DWP5y3XVZmIkJ MIME-Version: 1.0 X-Received: by 10.152.115.195 with SMTP id jq3mr5610182lab.90.1411120502616; Fri, 19 Sep 2014 02:55:02 -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 10:55:02 +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=001a11c355464b4040050368187d --001a11c355464b4040050368187d 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 my phone at a bus stop, or at least trying. (I'm now half way to Truro and on the third browser...) Negative patterns are confusing, I've discovered over the years. The way to think of them is "match anything but..." In other words, first match something, and only then decide what to exclude. In this case, the initial "match anything" matches files in the directory you've reached. Obviously there is no empty file. So the overall match fails at that point. Phew... time to hit send... pws --001a11c355464b4040050368187d--