From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14117 invoked from network); 29 Jun 2004 16:13:33 -0000 Received: from odin.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.85) by ns1.primenet.com.au with SMTP; 29 Jun 2004 16:13:33 -0000 Received: (qmail 20735 invoked from network); 29 Jun 2004 17:23:58 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 29 Jun 2004 17:23:58 -0000 Received: (qmail 27214 invoked by alias); 29 Jun 2004 16:12:47 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7617 Received: (qmail 27204 invoked from network); 29 Jun 2004 16:12:46 -0000 Received: from odin.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.85) by sunsite.dk with SMTP; 29 Jun 2004 16:12:46 -0000 Received: (qmail 19741 invoked from network); 29 Jun 2004 17:23:28 -0000 Received: from unknown (HELO moonbase.zanshin.com) (@167.160.213.139) by a.mx.sunsite.dk with SMTP; 29 Jun 2004 17:23:17 -0000 Received: from toltec.zanshin.com (toltec.zanshin.com [64.84.47.166]) by moonbase.zanshin.com (8.12.11/8.12.11) with ESMTP id i5TGCX8e010797 for ; Tue, 29 Jun 2004 09:12:33 -0700 Date: Tue, 29 Jun 2004 09:12:33 -0700 (PDT) From: Bart Schaefer Reply-To: zsh-users@sunsite.dk To: zsh-users@sunsite.dk Subject: Re: Suppressing "no matches found" Glob Message? In-Reply-To: <20040628085300.GA1443@DervishD> Message-ID: References: <2A3E94EA-C7E3-11D8-9C37-000502631FBD@columbia.edu> <20040627104222.GA237@DervishD> <6D3CE77E-C88C-11D8-A1EE-000A95EDC31A@louisville.edu> <20040628085300.GA1443@DervishD> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 On Mon, 28 Jun 2004, DervishD wrote: > In certain sense, what you want is impossible. If you issue the 'ls' > command with parameters, it will list those parameters (if they exist), > but if you don't give it params, it will list all files and dirs. You > cannot have a way of 'ls' shutting its mouth up if the pattern doesn't > match anything. Well, no, but you can have zsh not call "ls" in the first place if the pattern doesn't match anything. You're on the right track in a later posting on this thread where you used a function rather than an alias. Aliases can't do anything but simple text replacements which happen before any of the glob patterns or other expansions are evaluated. If you want to base a decision on the result of an expansion, you must use a function. In this case, something like lspf() { files=( **/*(.N) ) if (( $#files )) then ls $files else print -u2 "Dude, where's my file?" fi } Of course, when I try that, I get "argument list too long: ls" but that's a different issue.