From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21134 invoked by alias); 4 Mar 2012 20:13:18 -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: 16833 Received: (qmail 4844 invoked from network); 4 Mar 2012 20:13:16 -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.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.214.171 as permitted sender) Received-SPF: pass (google.com: domain of mikachu@gmail.com designates 10.60.14.101 as permitted sender) client-ip=10.60.14.101; Authentication-Results: mr.google.com; spf=pass (google.com: domain of mikachu@gmail.com designates 10.60.14.101 as permitted sender) smtp.mail=mikachu@gmail.com; dkim=pass header.i=mikachu@gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=uxfXzuxuDgeMIvJuXSBO7G6FBDEZmKpc/XYnATj5sYQ=; b=c568hob6xtuKwDtgAG6eqGKzP91lph5FEACwBgOSvElNsb7htCIVijr+sgRQAAAK43 5G1Ga/bMUVWbMudFzW2SnltJ4izmlIKs17r99UfEGzT4FnnHwbEbkUcbz5T1Ol9+7ftJ ksDfvztA2Fz657H1O0M5Dt2xWEyP0BaVGgW6Y25H63jsq3xAmU+uS1jugo9WpnIMmdeQ ln3r2m9laR9Y/jA1kztB8Scpq+/KzyIHSMOmXtOxLc+h9OWj43HITXjvTwrXbqi4FQKa 4cdgIzgbA3iuz4HRJaFkusiZNWFHLgdkyluz+T1qAJhmAw50KI96bHe00hgbdTHTtbaE MVWA== MIME-Version: 1.0 In-Reply-To: <120304114412.ZM24769@torch.brasslantern.com> References: <20120304143102.GE18164@solfire> <120304103757.ZM24588@torch.brasslantern.com> <120304114412.ZM24769@torch.brasslantern.com> Date: Sun, 4 Mar 2012 21:13:11 +0100 Message-ID: Subject: Re: if the file is not found the files is not found is the file not found From: Mikael Magnusson To: Bart Schaefer Cc: zsh-users@zsh.org Content-Type: text/plain; charset=UTF-8 On 4 March 2012 20:44, Bart Schaefer wrote: > On Mar 4, 7:48pm, Mikael Magnusson wrote: >> >> On 4 March 2012 19:37, Bart Schaefer wrote: >> > I'm sure the archives of zsh-users hold many different answers to the >> > question, "Given a file pattern, how do I test whether at least one >> > matching file exists?" >> >> Here's one more for the collection, >> if () { (( $# )) } arglblargh*(N[1]); then echo yes; else echo no; fi > > Yes, I was thinking about that but it doesn't capture the "is a plain > file" semantics of [[ -f ]] -- which you can fix by adding qualifiers > to the glob instead, of course -- and even my formulation falls down > if the glob matches a mix of plain and not-plain files and the first > one happens to be the wrong kind. > > (Also, the [1] in your formula is extraneous, but that's a nit.) I like to imagine that it causes less data to be copied around. :) -- Mikael Magnusson