Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Simplest way to choose one of several commands



all the command in path are in the associative array $commands so
assuming that at least ls is in the path :
alias ls="${commands[gls]:-$commands[ls]} --color"
it seems simpler to me

2009/9/7 Nikolai Weibull <now@xxxxxxxx>:
> Is there a simpler way of doing the following?
>
> alias ls=${${(f)"$(whence -p {g,}ls)"}[1]}' --color'
>
> I need to select gls, if that’s what’s installed, otherwise ls.  (The
> code above assumes that at least ls is installed, which isn’t a
> problem.)
>



Messages sorted by: Reverse Date, Date, Thread, Author