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 14351
- From: Nikolai Weibull <now@xxxxxxxx>
- To: Sebastian Stark <seb-zsh@xxxxxxxxxxx>
- Subject: Re: Simplest way to choose one of several commands
- Date: Tue, 8 Sep 2009 11:34:27 +0200
- Cc: Zsh Users <zsh-users@xxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=tnJF6cd6vGnuW20nHcL+TOC6UvxX19thoSxXxV9nw10=; b=FXz6kUvVttlXSAMfhqTv/6LtLbq94/yYFY0Q+ZdeG8/nckTgEefBbnzZaU2g8YIje8 hJ9g31Y8a9QipedY4cpR13SO8ih4YOKdora+B5mJYFNZzsgQGWHkt34PCNe0Gn0pVmlS N0fZedkdAYkOJTDAvV0wRcJnLIQjA9uyU7f5o=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=dUoikZhnF4Ec9QnEuJkIxkyf/9PaWsVvfw0iK/D7hsLqJvrQStgPo9bswMadhYuHQ4 5urzeRzL8oPMpZYquyAFo733G7/1Y+5gH/V510by2Uvf38XK798KvSty39tyup7o4+GU b/HhrNj2CnnXruDdDHLCnvWggdrnb1B5sbz8w=
- In-reply-to: <D75FF918-CFF5-4244-A6D1-0709210B5F50@xxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <dbfc82860909070922u19535071v17842f1f10ffed4@xxxxxxxxxxxxxx> <D75FF918-CFF5-4244-A6D1-0709210B5F50@xxxxxxxxxxx>
- Sender: nikolai.weibull@xxxxxxxxx
On Tue, Sep 8, 2009 at 11:29, Sebastian Stark<seb-zsh@xxxxxxxxxxx> wrote:
> On 07.09.2009, at 18:22, Nikolai Weibull wrote:
>> Is there a simpler way of doing the following?
>> alias ls=${${(f)"$(whence -p {g,}ls)"}[1]}' --color'
> Âfor ls in gls ls; do whence $ls >/dev/null && {alias ls="$ls --color";
> break}; done; unset ls
By simple I meant short. Your solution is, eh, not short. ;-)
> Besides this it can be easily extended to adopt handling of different
> platforms (ls --color on darwin wonât work). I think this kind of thing
> needs to be done with less zshisms to be powerful.
Well, thatâs exactly why Iâm doing what Iâm doing. Choose gls if
thatâs installed, that is, weâre on, for example, Darwin. Otherwise,
choose ls and hope that weâre on Linux, Cygwin, or similar system
where GNU ls is installed as ls.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author