[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gobolinux-users
Subject:    Re: [gobolinux-users] which
From:       Hisham <hisham.hm () gmail ! com>
Date:       2008-03-26 19:45:24
Message-ID: 5e7d91620803261245r68702719iae00894e7e29e8fb () mail ! gmail ! com
[Download RAW message or body]

On Tue, Mar 25, 2008 at 1:03 AM, Nick Matteo <kundor@kundor.org> wrote:
> The "which" provided by Scripts doesn't have the standard "-a" option.
>   I've had scripts complain about this (and even fail) a time or two.
>  Also, I find it annoying that "which info" lies to me about what
>  "info" runs if it is an alias.
>
>  To deal with these issues, perhaps it would have been easy enough to
>  have Scripts' which do a "-a" and alias which=whence for interactive
>  use.  But instead I wrote a big which-function. ;-)
>
>  By placing this function in /etc/zshenv, it's used even for scripts
>  and such.  (It needs to be a function, not a script, to be able to
>  access aliases etc. in interactive mode.)  Then I replace the "which"
>  script in the path with a simple script like so:
>
>  #!/bin/zsh
>  which -f $@
>
>  To have my script used by other programs appropriately.
>  If you'd like to do the same, you can get the zshenv at
>  http://kundor.org/gobostuff/zshenv .  If you place this file in
>  /Programs/ZSH/Settings,
>  then
>  cd /Programs/ZSH/Settings
>  zcompile zshenv
>  (You may need root for that)
>  SymlinkProgram ZSH
>
>  It will create a precompiled version of the function to speed up shell
>  loads.  (You can also "zcompile zshrc" for the same purpose.)
>  Then put that two-liner script in your path as "which" and you will
>  get an option-accepting, alias-reporting which ;-)
>
>  Options taken are -h/--help, -a/--all (reports multiple results from path),
>  -p/--path-only (Normally, an alias, builtin, or function is reported
>  as e.g. "aliased to /Programs/Foo/1/...".  This strips everything but
>  the path so that "file `which -p foo`" and similar constructs will
>  work properly),
>  -f/--file-only (This doesn't check aliases, builtins, or functions,
>  reverting to checking for executables only.)

Cool -- I installed it here in my machine to test this for a while.
Results look interesting already. :)

-- Hisham
_______________________________________________
gobolinux-users mailing list
gobolinux-users@lists.gobolinux.org
http://lists.gobolinux.org/mailman/listinfo/gobolinux-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic