zsh-users
 help / color / mirror / code / Atom feed
From: Dan Kenigsberg <danken@cs.Technion.AC.IL>
To: guckes@math.fu-berlin.de (Sven Guckes)
Cc: zsh-users@sunsite.dk
Subject: Re: listing all executables by prefix - solution!
Date: Tue, 16 Apr 2002 15:03:04 +0300 (IDT)	[thread overview]
Message-ID: <200204161203.PAA16978@csd.cs.technion.ac.il> (raw)
In-Reply-To: <20020415194324.GA19387@ritz.math.fu-berlin.de> from "Sven Guckes" at Apr 15, 2002 09:43:25 PM

> 
> * Bart Schaefer <schaefer@brasslantern.com> [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.



  reply	other threads:[~2002-04-16 12:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-15 17:31 listing all executables by prefix? Sven Guckes
2002-04-15 17:56 ` Bart Schaefer
2002-04-15 18:16   ` Peter Stephenson
2002-04-15 19:43   ` listing all executables by prefix - solution! Sven Guckes
2002-04-16 12:03     ` Dan Kenigsberg [this message]
2002-04-16 13:40       ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200204161203.PAA16978@csd.cs.technion.ac.il \
    --to=danken@cs.technion.ac.il \
    --cc=guckes@math.fu-berlin.de \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).