From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28772 invoked by alias); 30 May 2014 04:00: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: 18861 Received: (qmail 9201 invoked from network); 30 May 2014 04:00:18 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <140529205956.ZM17410@torch.brasslantern.com> Date: Thu, 29 May 2014 20:59:56 -0700 In-reply-to: <20140526235216.GC1920@tarsus.local2> Comments: In reply to Daniel Shahaf "Re: globbing in conditional expressions" (May 26, 11:52pm) References: <20140507154407.660eb500@pwslap01u.europe.root.pri> <20140508105522.GE2052@tarsus.local2> <20140508122045.3c68c3fa@pwslap01u.europe.root.pri> <140508083418.ZM14713@torch.brasslantern.com> <20140508201936.GB53652@isis.sigpipe.cz> <140513084117.ZM22925@torch.brasslantern.com> <20140514041908.GF2471@tarsus.local2> <140514001819.ZM23478@torch.brasslantern.com> <20140515092901.GC2174@tarsus.local2> <140515075003.ZM28035@torch.brasslantern.com> <20140526235216.GC1920@tarsus.local2> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: globbing in conditional expressions MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On May 26, 11:52pm, Daniel Shahaf wrote: } } } Bart Schaefer wrote on Thu, May 15, 2014 at 07:50:03 -0700: } > adding a globbing flag (#X) [where I'm using X as a placeholder rather } > than a suggestion for the actual flag] which means that the glob returns } > only the first matching file it stumbles upon. } > } > In fact if you had that flag you wouldn't need -m as a condition op, it } > would suffice to do [ ! -z pat(NX) ]. } } That turned out to be much less code to implement. It's attached, if } anyone finds it useful. I like this one. Is there a mnemonic for your choice of (Y) ? } I couldn't get it to work via [ -z ] Hmm, seems to work for me: torch% print co* config.h config.log config.modules config.modules.sh config.status torch% print co*(Y) config.h torch% print ba* zsh: no matches found: ba* torch% [ -z ba*(N) ] && echo OK OK torch% [ ! -z ba*(NY) ] && echo OK torch% [ ! -z co*(NY) ] && echo OK OK To zsh-workers: Any reason not to commit/push this?