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

Re: array contains "foo"



-----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