bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: List of keys of an associative array


From: dnade.ext
Subject: RE: List of keys of an associative array
Date: Fri, 31 Dec 2010 10:56:35 +0100

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é <address@hidden>
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:address@hidden
Envoyé : vendredi 31 décembre 2010 10:52
À : NADE Damien Ext DMGP/PORTAIL
Cc : address@hidden
Objet : Re: List of keys of an associative array


On Fri, Dec 31, 2010 at 11:38 AM, <address@hidden<mailto:address@hidden>> wrote:
       Hello

For regular arrays, we can get the list of keys by using the form address@hidden
But this just doesn’t work for associative arrays.

address@hidden 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 address@hidden
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.
********************************


reply via email to

[Prev in Thread] Current Thread [Next in Thread]