Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: array contains "foo"
- X-seq: zsh-users 8634
- From: Andrey Borzenkov <arvidjaar@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: array contains "foo"
- Date: Sun, 27 Mar 2005 01:32:54 +0300
- Cc: Dave Yost <Dave@xxxxxxxx>
- In-reply-to: <pdy98830621028bbe6b7bc50d64@[192.168.1.2]>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <pdy98830621028bbe6b7bc50d64@[192.168.1.2]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[Redirected to zsh-users]
On Saturday 26 March 2005 23:53, Dave Yost wrote:
> Hi.
>
> I've beat my head against the zsh manual for an hour now, and I can't
> see how to test whether
>
> x=(foo bar)
>
> contains foo (yes) or contains xyz (no).
>
{pts/1}% x=(foo bar)
{pts/1}% echo ${${x[(r)foo]}:+yes}
yes
{pts/1}% echo ${${x[(r)xyz]}:-no}
no
- -andrey
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCReMXR6LMutpd94wRAvujAJ0YV/OKpI6/qbtVQ3mkJBGfr3x+lwCgwy0J
j0QcqPMA84ZkKhk7ZEb1p/w=
=EJVK
-----END PGP SIGNATURE-----
Messages sorted by:
Reverse Date,
Date,
Thread,
Author