Ha. Indeed, if i use declare –A, it works. But why is bash letting me use foo[bar]=something in the first place, if I don’t declare foo as an associative array ? Maybe the bug’s here.
D -- Damien Nadé <dnade....@orange-ftgroup.com> Astek Sud-Est pour France Télécom - FT/TGPF/OPF/PORTAIL/DOP/DEV/EAQS Sophia Antipolis - France / Tel : 04 97 12 86 20 De : Pierre Gaston [mailto:pierre.gas...@gmail.com] Envoyé : vendredi 31 décembre 2010 10:52 À : NADE Damien Ext DMGP/PORTAIL Cc : bug-bash@gnu.org Objet : Re: List of keys of an associative array On Fri, Dec 31, 2010 at 11:38 AM, <dnade....@orange-ftgroup.com<mailto:dnade....@orange-ftgroup.com>> wrote: Hello For regular arrays, we can get the list of keys by using the form ${!some_arr...@]}. But this just doesn’t work for associative arrays. ${!some_associative_arr...@]} is actually 0. Is that a bug ? Is there another way to get the list of keys available in an associative array ? $ declare -A a;a[foo]=bar;a[baz]=bux;echo ${...@]} baz foo ********************************* This message and any attachments (the "message") are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited. Messages are susceptible to alteration. France Telecom Group shall not be liable for the message if altered, changed or falsified. If you are not the intended addressee of this message, please cancel it immediately and inform the sender. ********************************