Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Simplest way to choose one of several commands
- X-seq: zsh-users 14365
- From: Thorsten Kampe <thorsten@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Simplest way to choose one of several commands
- Date: Sun, 13 Sep 2009 12:39:27 +0200
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <dbfc82860909070922u19535071v17842f1f10ffed4@xxxxxxxxxxxxxx>
- Sender: news <news@xxxxxxxxxxxxx>
* 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