Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Check existence of an element of an array (a FAQ?)
- X-seq: zsh-users 12886
- From: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Check existence of an element of an array (a FAQ?)
- Date: Fri, 30 May 2008 10:43:58 +0200
- In-reply-to: <tkrat.6fc8d798a167c9eb@xxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <tkrat.6fc8d798a167c9eb@xxxxxxxxxxxxxxxxxxx>
Helmut Jarausch <jarausch@xxxxxxxxxxxxxxxxxxx>:
> please help me with the following:
>
> Is there an elegant way (i.e. without a loop) to
> get the following action
>
> Special_Users=('you','me',......)
>
> U='nobody'
>
> if $U in $Special_Users
> # do something
> fi
[snip]
if [[ -n ${(M)Special_Users:#${U}} ]] ; then
echo $U is in there
fi
[snap]
Regards, Frank
--
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
-- RFC 1925
Messages sorted by:
Reverse Date,
Date,
Thread,
Author