Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: ${_comps[(K)*diff*]}
- X-seq: zsh-workers 10050
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: RE: ${_comps[(K)*diff*]}
- Date: Fri, 10 Mar 2000 11:32:18 +0100 (MET)
- In-reply-to: "Andrej Borsenkow"'s message of Fri, 10 Mar 2000 13:04:29 +0300
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Andrej Borsenkow wrote:
> > >
> > > What you miss is that [(k)...] and [(K)...] don't do pattern-matching
> > > on the keys. I have an idea what's going wrong, but I don't have time
> > > to fix it right now.
> >
> > (I don't see anything wrong here, what am I missing?)
> >
>
> k
> If used in a subscript on a parameter that is not an associative
> array, this behaves like `r', but if used on an association, it
> makes the keys be interpreted as patterns and returns the first
> value whose key matches the EXP.
>
> K
> On an associtation this is like `k' but returns all values whose
> keys match the EXP. On other types of parameters this has the same
> effect as `R'.
I know that -- I've written it. Again: so what? Looking at the ouput
you got:
bor@itsrm2% print ${_comps[(K)*diff*]}
=== nothing ===
The keys of $_comps are used as patterns (none of them is a real
pattern, they are just strings -- the names of commands and special
context), but none of them matches the string `*diff*'. So you get
nothing. Of course. Right? Maybe what you wanted is the (I) flag?
(That (I) and (K) do what they do and that they are named the way they
are named may be a bit irritating -- probably less when thinking about
normal arrays instead of associations -- but that has historical
reasons. (K) just came later.)
Bye
Sven
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author