Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Test for features?
- X-seq: zsh-users 14744
- From: "Benjamin R. Haskell" <benizi@xxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Test for features?
- Date: Mon, 25 Jan 2010 01:13:09 -0500 (EST)
- In-reply-to: <alpine.LNX.2.01.1001250001570.20648@xxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <alpine.LNX.2.01.1001250001570.20648@xxxxxxxxxxx>
On Mon, 25 Jan 2010, Benjamin R. Haskell wrote:
> I see this came up before [1], and since it was relatively recent, I
> assume the answer is the same, but:
>
> Is there a good way to test for features in Zsh?
>
> Specifically, I didn't realize that the ':a' and ':A' modifiers(sp?)
> were recent additions, while dropping my .zshrc onto an OpenSolaris
> box w/ SUNWzsh 4.3.9. (Though it does make me feel less crazy for not
> having used them the whole time.)
Hmm... interesting side note: only one kind of ':A' modifier* doesn't
work.
This works (1): p=( ~(:A) )
This doesn't (2): p=~ ; p=${p:A}
zsh: unrecognized modifier `A'
The upside is that further testing also revealed a far-simpler 'feature'
test:
has_A=$(eval 'p=~ ; p=${p:A} ; echo true' 2>/dev/null || echo false)
$has_A && echo yay
--
Best,
Ben
[*] I still always mix up my terminology for:
glob modifiers
history modifiers
expansion modifiers
Is the correct terminology: (1) glob modifier and (2) history modifier?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author