Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: listing all executables by prefix - solution!
- X-seq: zsh-users 4839
- From: Dan Kenigsberg <danken@xxxxxxxxxxxxxxxxx>
- To: guckes@xxxxxxxxxxxxxxxxx (Sven Guckes)
- Subject: Re: listing all executables by prefix - solution!
- Date: Tue, 16 Apr 2002 15:03:04 +0300 (IDT)
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <20020415194324.GA19387@xxxxxxxxxxxxxxxxxxxxxx> from "Sven Guckes" at Apr 15, 2002 09:43:25 PM
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
>
> * Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> [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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author