From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23396 invoked from network); 14 Jun 2004 08:33:32 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.86) by ns1.primenet.com.au with SMTP; 14 Jun 2004 08:33:32 -0000 Received: (qmail 13593 invoked from network); 14 Jun 2004 08:32:57 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 14 Jun 2004 08:32:57 -0000 Received: (qmail 20048 invoked by alias); 14 Jun 2004 08:32:26 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7540 Received: (qmail 20034 invoked from network); 14 Jun 2004 08:32:25 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.86) by sunsite.dk with SMTP; 14 Jun 2004 08:32:22 -0000 Received: (qmail 12447 invoked from network); 14 Jun 2004 08:32:22 -0000 Received: from moonbase.zanshin.com (root@64.84.47.139) by a.mx.sunsite.dk with SMTP; 14 Jun 2004 08:32:20 -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 i5E8WI2T022608 for ; Mon, 14 Jun 2004 01:32:18 -0700 Date: Mon, 14 Jun 2004 01:31:55 -0700 (PDT) From: Bart Schaefer Sender: schaefer@toltec.zanshin.com Reply-To: zsh-users@sunsite.dk To: zsh-users@sunsite.dk Subject: Re: ignore globs that do not match In-Reply-To: <20040614073704.GA18465@fruitcom.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=iso-8859-1 Content-Transfer-Encoding: 8BIT 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, 14 Jun 2004, Eric Smith wrote: > Thomas Köhler said: > > mpg() { > > local arg > > local l > > for arg ; do l="*$arg* $l" ; done > > eval mpg321 $l > > } > > > > Nice! Almost equivalent to, but more wordy than, my *${^@}* solution. The only difference is that e.g.: mpg 'd*n' (note quotes) evals "mpg321 *d*n*" and therefore expands the middle "*" as well. It wasn't clear you wanted those semantics. > ("setopt cshnullglob" does not seem to work.) That would be the way. Works when I try it, with either formulation of the function. > $ mpg dylan gibberish crespo Are you sure there are no globbing characters in the gibberish? The setopt will only apply inside the function, e.g. if you say $ mpg foo*bar then the shell first attempts to glob foo*bar and either gets "no match" or calls the mpg function with the results as arguments. Perhaps what you're after is something like: mpg_glob() { mpg321 *${~^@}* } alias mpg='noglob mpg_glob'