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

Re: get keys of an associative array?



On Sun, Mar 26, 2017 at 01:03:31PM -0700, Bart Schaefer wrote:
> On Mar 26, 2017 12:41 PM, "Peter Stephenson" <p.w.stephenson@xxxxxxxxxxxx>
> wrote:
> 
> You need "${(k)A[@]}" in ksh mode, but I'm not sure why the (@) flag
> doesn't do the trick.
> 
> The @ flag only makes things that are already arrays remain arrays in
> contexts where they would otherwise be joined.  In ksharrays context, ${A}
> is a scalar.

You mean man page section for the k flag needs enhancements? At least A
is explictly declared as an associative array, so I would expect, that
"${(k)A}" should work as well ...

Thanx,
jel.
-- 
Otto-von-Guericke University     http://www.cs.uni-magdeburg.de/
Department of Computer Science   Geb. 29 R 027, Universitaetsplatz 2
39106 Magdeburg, Germany         Tel: +49 391 67 52768



Messages sorted by: Reverse Date, Date, Thread, Author