Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: is a key of pointed key set ? (where is the + )
- X-seq: zsh-users 10942
- From: Marc Chantreux <marc.chantreux@xxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: is a key of pointed key set ? (where is the + )
- Date: Mon, 6 Nov 2006 11:13:37 +0100
- In-reply-to: <200611061120.14277.arvidjaar@xxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20061106080431.GA17141@xxxxxxxxxxxxxxxxxx> <200611061120.14277.arvidjaar@xxxxxxxxxx>
le 06/11/2006,
Andrey Borzenkov nous écrivait :
> > pnt=h
> > typeset -A h
> > h=( k1 value )
> >
> > so :
> >
> > echo ${${(P)pnt}[k1]}
> > prints value
> >
> > but how to know if the key itself is set ?
>
> {pts/0}% typeset -A h
> {pts/0}% h=(k v)
> {pts/0}% print -- ${(k)h[k]+set}
> set
> {pts/0}% print -- ${(k)h[k1]-unset}
> unset
well .. (( $+h[k] )) does the same. You missed a part of the problem :
my associative array is "Pointed" (P).
so we can imagine :
[[ -n ${(k)${(P)pnt}[k1]} ]] && print "${pnt}[k1] is set"
but it doesn't work.
thanks for help
mc
--
téléphone : 03.90.24.00.19
courriel : marc.chantreux@xxxxxxxxxxxxxxxxxx
---------------------------------------
Messages sorted by:
Reverse Date,
Date,
Thread,
Author