Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
get keys of an associative array?
- X-seq: zsh-workers 40901
- From: Jens Elkner <jel+zsh@xxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: get keys of an associative array?
- Date: Sun, 26 Mar 2017 21:18:28 +0200
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Hi,
I've KSH_ARRAYS (beside KSH_GLOB KSH_TYPESET KSH_OPTION_PRINT) set,
however, getting the key set of an array via ${!vname[@]} (as usually
done within ksh or bash) does not work (bad substitution). Couldn't find
anything else, except the @k flag, but this doesn't work as well, e.g.
unset A; typeset -A A; A['a']=1; A['b']=2; A['c']=3 ; print "${(@k)A}"
should print 'a b c' but prints '3'. Bug, feature? Hmmm, any hints?
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