From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8023 invoked from network); 29 Jun 2004 23:04:58 -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 23:04:58 -0000 Received: (qmail 26605 invoked from network); 30 Jun 2004 00:15:34 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 30 Jun 2004 00:15:34 -0000 Received: (qmail 16777 invoked by alias); 29 Jun 2004 23:04:11 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7623 Received: (qmail 16767 invoked from network); 29 Jun 2004 23:04:09 -0000 Received: from odin.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.85) by sunsite.dk with SMTP; 29 Jun 2004 23:04:09 -0000 Received: (qmail 25593 invoked from network); 30 Jun 2004 00:15:03 -0000 Received: from erouter0.it-datacntr.louisville.edu (136.165.5.194) by a.mx.sunsite.dk with SMTP; 30 Jun 2004 00:14:55 -0000 Received: from [192.168.1.35] (tiger.slug.louisville.edu [136.165.47.43]) by erouter0.it-datacntr.louisville.edu (Postfix) with ESMTP id 774C21260 for ; Tue, 29 Jun 2004 19:04:00 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v618) In-Reply-To: References: <2A3E94EA-C7E3-11D8-9C37-000502631FBD@columbia.edu> <20040627104222.GA237@DervishD> <6D3CE77E-C88C-11D8-A1EE-000A95EDC31A@louisville.edu> <20040628085300.GA1443@DervishD> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <9B465416-CA20-11D8-951F-000A95EDC31A@louisville.edu> Content-Transfer-Encoding: 7bit From: Aaron Davies Subject: Re: Suppressing "no matches found" Glob Message? Date: Tue, 29 Jun 2004 19:04:00 -0400 To: zsh-users@sunsite.dk X-Mailer: Apple Mail (2.618) X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=1.0 required=6.0 tests=FROM_ENDS_IN_NUMS autolearn=no version=2.63 X-Spam-Hits: 1.0 On Jun 29, 2004, at 12:12 PM, Bart Schaefer wrote: > 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 > } This works great on one of the boxes I use zsh on (a OS X Panther) box, but not on the other (a Jaguar box). On the 10.2 one, I get zsh: lspf: function definition file not found when I try to run the function, despite having fpath=(~/Documents/functions $fpath) autoload lspf in .zshrc and the above definition for lspf in ~/Documents/functions/lspf.sh . What's wrong? > Of course, when I try that, I get "argument list too long: ls" but > that's > a different issue. -- Aaron Davies agdavi01@louisville.edu