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

Re: is a key of pointed key set ? (where is the + )



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