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

Re: Simplest way to choose one of several commands



* Nikolai Weibull (Mon, 7 Sep 2009 18:22:12 +0200)
> 
> 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.)

I use something like

    type jed &> /dev/null && DEFAULT_EDITOR=jed || DEFAULT_EDITOR=vim

It's simple, readable and works in my .zshrc as well as in my .bashrc.

Thorsten



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