Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11384

Re: quoted compound array assignment deprecated

From Dan Douglas <ormaaj@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: quoted compound array assignment deprecated
Date 2015-08-18 16:05 -0500
Message-ID <mailman.8573.1439931911.904.bug-bash@gnu.org> (permalink)
References <CAAZkfoJJdVc5A9WMmBcUqUMjN=2VBq6rtuoDYVO5iMQDoLjS9Q@mail.gmail.com> <CAAZkfoJyOyo=2zE63OYaZua73E-HCTd4bCmMkJDNzhJ5hgVAgw@mail.gmail.com> <55D38D5C.2050605@case.edu>

Show all headers | View raw


Sorry I meant to reply to that thread but ran out of time. I think Stephane's 
eventual proposal was pretty close to what I had in mind but expressed badly. 
I'm not sure why it was eventually decided to deprecate the current system 
entirely but I'm not opposed to the idea - especially if it provides no 
functionality for which there aren't easy workarounds.

The only thing I'm actively abusing this for at the moment in scripts I 
actually use is as a way of encoding 2D arrays. It's very much a read-only 
datastructure too.

~ $ ( key1=foo key2=bar; declare -A a=([foo]='([bar]=baz)') "b=${a[$key1]}"
typeset -p a b; echo "${b[$key2]}" )
declare -A a='([foo]="([bar]=baz)" )'
declare -A b='([bar]="baz" )'
baz

Any change will likely break this property but I think wrapping it in eval 
gives the same result.

-- 
Dan Douglas

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: quoted compound array assignment deprecated Dan Douglas <ormaaj@gmail.com> - 2015-08-18 16:05 -0500

csiph-web