From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21112 invoked from network); 1 Mar 2006 14:25:58 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO, NO_REAL_NAME autolearn=no version=3.1.0 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 1 Mar 2006 14:25:58 -0000 Received: (qmail 7607 invoked from network); 1 Mar 2006 14:25:51 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Mar 2006 14:25:51 -0000 Received: (qmail 21714 invoked by alias); 1 Mar 2006 14:25:41 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9971 Received: (qmail 21703 invoked from network); 1 Mar 2006 14:25:40 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 1 Mar 2006 14:25:40 -0000 Received: (qmail 6405 invoked from network); 1 Mar 2006 14:25:40 -0000 Received: from webmail4.sd.dreamhost.com (64.111.100.16) by a.mx.sunsite.dk with SMTP; 1 Mar 2006 14:25:37 -0000 Received: from webmail.phydeaux.org (localhost [127.0.0.1]) by webmail4.sd.dreamhost.com (Postfix) with ESMTP id C7C11301FC for ; Wed, 1 Mar 2006 06:25:34 -0800 (PST) Received: from 24.98.225.32 (SquirrelMail authenticated user fletch@phydeaux.org) by webmail.phydeaux.org with HTTP; Wed, 1 Mar 2006 09:25:34 -0500 (EST) Message-ID: <58026.24.98.225.32.1141223134.squirrel@webmail.phydeaux.org> Date: Wed, 1 Mar 2006 09:25:34 -0500 (EST) Subject: Re: alias limg='ls *.{jpg,gif}(.N)' From: fletch@phydeaux.org To: zsh-users@sunsite.dk User-Agent: SquirrelMail/1.4.4 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit References: <20060228181747.GB18839@namib.cs.utk.edu> <20060228234110.GD25687@prunille.vinc17.org> In-Reply-To: <20060228234110.GD25687@prunille.vinc17.org> > On 2006-02-28 13:17:47 -0500, Chris Johnson wrote: >> zzapper sent me the following 0.2K: >> > I was proud of my little alias >> > >> > alias limg='ls *.{jpg,gif}(.N)' >> > >> > But it has a teeny-weeny fault; if no image is found it lists >> everything >> There was some discussion on this in 2004, in which print was suggested as a replacement to ls. Try: >> http://www.zsh.org/mla/users/2004/msg00621.html > > But ls would be better if you want the possibility to add options: > > limg() { ls "$@" *.{jpg,gif}(.N) } limg () { local -a images images=( *.{jpg,gif,png}(.N) ) if [[ $#images -eq 0 ]] ; then print "No image files found" else ls "$@" "$images[@]" fi } -- Fletch | "If you find my answers frightening, __`'/| fletch at phydeaux.org| Vincent, you should cease askin' \ o.O' | scary questions." -- Jules =(___)= | U