Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.unix.shell > #4932
| From | Francis Moreau <francis.moro@gmail.com> |
|---|---|
| Newsgroups | comp.unix.shell |
| Subject | Re: bash: Initialisation of an associative array using a compound assignment |
| Date | 2012-05-08 00:57 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <28536388.3425.1336463865455.JavaMail.geo-discussion-forums@vbyb13> (permalink) |
| References | <0d56e766-9a3f-45ec-a8e9-b212375cf035@gn8g2000vbb.googlegroups.com> <3gjd79-lha.ln1@cjlocal.com> <barmar-46664D.19154504052012@news.eternal-september.org> |
On Saturday, May 5, 2012 1:15:46 AM UTC+2, Barry Margolin wrote: > In article <3gjd79-lha.ln1@cjlocal.com>, > "Chris F.A. Johnson" <cfajohnson@gmail.com> wrote: > > > On 2012-05-04, Francis Moreau wrote: > > > Hello, > > > > > > I don't understand why initialising an associative array like the > > > following doesn't work: > > > > > > $ declare -A a > > > $ a=($(echo '[key]=val') > > > bash: a: [key]=val: must use subscript when assigning associative > > > array > > > > > > Could anybody enlight me ? > > > > a=( [key]=val ) > > > > Or: > > > > eval "a=( $(echo '[key]=val') )" > > He asked *why*. > > The answer is presumably due to the order that the shell does its > parsing. It looks for [subscript] *before* expanding process > substutions. BTW, could anybody tell me where this is described in the bash documentation ? Thanks
Back to comp.unix.shell | Previous | Next — Previous in thread | Next in thread | Find similar
bash: Initialisation of an associative array using a compound assignment Francis Moreau <francis.moro@gmail.com> - 2012-05-04 01:43 -0700
Re: bash: Initialisation of an associative array using a compound assignment "Chris F.A. Johnson" <cfajohnson@gmail.com> - 2012-05-04 14:24 -0400
Re: bash: Initialisation of an associative array using a compound assignment Barry Margolin <barmar@alum.mit.edu> - 2012-05-04 19:15 -0400
Re: bash: Initialisation of an associative array using a compound assignment Janis Papanagnou <janis_papanagnou@hotmail.com> - 2012-05-05 09:42 +0200
Re: bash: Initialisation of an associative array using a compound assignment Barry Margolin <barmar@alum.mit.edu> - 2012-05-05 17:43 -0400
Re: bash: Initialisation of an associative array using a compound assignment Janis Papanagnou <janis_papanagnou@hotmail.com> - 2012-05-06 03:41 +0200
Re: bash: Initialisation of an associative array using a compound assignment Barry Margolin <barmar@alum.mit.edu> - 2012-05-05 22:34 -0400
Re: bash: Initialisation of an associative array using a compound assignment Francis Moreau <francis.moro@gmail.com> - 2012-05-06 07:30 -0700
Re: bash: Initialisation of an associative array using a compound assignment Francis Moreau <francis.moro@gmail.com> - 2012-05-06 07:35 -0700
Re: bash: Initialisation of an associative array using a compound assignment Francis Moreau <francis.moro@gmail.com> - 2012-05-08 00:57 -0700
Re: bash: Initialisation of an associative array using a compound assignment Stephane Chazelas <stephane.chazelas@gmail.com> - 2012-05-06 17:16 +0100
Re: bash: Initialisation of an associative array using a compound assignment Janis Papanagnou <janis_papanagnou@hotmail.com> - 2012-05-07 02:06 +0200
csiph-web