* pws-19: comparing (k) and (I) for hashes
@ 1999-05-25 12:23 Andrej Borsenkow
1999-05-25 14:55 ` Peter Stephenson
0 siblings, 1 reply; 2+ messages in thread
From: Andrej Borsenkow @ 1999-05-25 12:23 UTC (permalink / raw)
To: ZSH workers mailing list
>From manual I got the impression, that ${(k)...} and ${...[(I)...]} do the
same - both return the keys of matching elements. Cf. (I) description:
`I'
like ``i', but gives the index of the last match, or all possible
matching keys in an associative array.
In case of parameters hash, the keys are parameter names, so
bor@itsrm2:~%> print -l ${(k)parameters[(R)scalar*]} | grep foo
foo
bor@itsrm2:~%>
(as expected), but
bor@itsrm2:~%> print -l ${parameters[(I)scalar*]} | grep foo
bor@itsrm2:~%>
What do I do wrong?
/andrej
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: pws-19: comparing (k) and (I) for hashes
1999-05-25 12:23 pws-19: comparing (k) and (I) for hashes Andrej Borsenkow
@ 1999-05-25 14:55 ` Peter Stephenson
0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 1999-05-25 14:55 UTC (permalink / raw)
To: ZSH workers mailing list
"Andrej Borsenkow" wrote:
> >From manual I got the impression, that ${(k)...} and ${...[(I)...]} do the
> same - both return the keys of matching elements. Cf. (I) description:
>
> `I'
> like ``i', but gives the index of the last match, or all possible
> matching keys in an associative array.
Actually, I just specifies that it should search the keys (which correspond
to the index of an ordinary array). k and v still determine what is
returned, except that for I and i the default is to show the key instead of
the value.
--
Peter Stephenson <pws@ibmth.df.unipi.it> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1999-05-25 15:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-05-25 12:23 pws-19: comparing (k) and (I) for hashes Andrej Borsenkow
1999-05-25 14:55 ` Peter Stephenson
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).