From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9881 invoked from network); 16 Apr 2002 12:03:27 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 16 Apr 2002 12:03:27 -0000 Received: (qmail 24719 invoked by alias); 16 Apr 2002 12:03:06 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 4839 Received: (qmail 24707 invoked from network); 16 Apr 2002 12:03:05 -0000 From: Dan Kenigsberg Message-Id: <200204161203.PAA16978@csd.cs.technion.ac.il> Subject: Re: listing all executables by prefix - solution! To: guckes@math.fu-berlin.de (Sven Guckes) Date: Tue, 16 Apr 2002 15:03:04 +0300 (IDT) Cc: zsh-users@sunsite.dk In-Reply-To: <20020415194324.GA19387@ritz.math.fu-berlin.de> from "Sven Guckes" at Apr 15, 2002 09:43:25 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit > > * Bart Schaefer [2002-04-15 17:56]: > > ls -l ${(@)$(hash -m prefix\*)#*=} > > thanks, Bart! :-) > > but there must be something about > what Peter Stephenson said in his mail, > because his version works always. so > now I'm using "whence" in my function: > > # function _lap { for i in ${(@)$(hash -m $1\*)#*=}; do ls -l $i; done} > function _lap { for i in "${(@f)$(whence -pm $1\*)}"; do ls -l $i; done} > > zsh> _lap zsh > -rwxr-xr-x 2 guckes emailer 456536 Oct 29 03:32 /home/sguckes/bin/zsh-4.0.4 > -rwxr-xr-x 1 root root 405212 Jun 23 1999 /import/local/bin/zsh-3.0.5 > -rwxr-xr-x 3 root other 492576 Mar 24 2001 /import/local/bin/zsh-3.0.6 > -rwxr-xr-x 3 root other 492576 Mar 24 2001 /import/local/bin/zsh-3.0.8 > -rwxr-xr-x 2 guckes emailer 456536 Oct 29 03:32 /home/sguckes/bin/zsh > > cool! :-) > and something like: function _lap { tmp="${(@f)$(whence -pm $1\*)}"; [[ ! -z $tmp ]] && ls -l ${=tmp} } will produce fewer processes on the way. Dan. P.S. I wouldn't know why function _lap { tmp=$(whence -pm $1\*); [[ ! -z $tmp ]] && ls -l ${=tmp} } is not as good, but I'm such a shameless newbie, so it is not that surprising.