On 8/30/16 2:43 PM, Wesley Hirsch wrote:
> My guess is that is caused by the fact that initial
> wordsplitting separates
> the components before brace expansion can get to them, but this is
> unintuitive, and either the behavior should change or the
> documentation
>
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE
On Mon, Aug 29, 2016 at 11:28:47PM -0400, Wesley Hirsch wrote:
> ((++a[\$b]))
These three also work:
(('++a[$b]'))
(('++a["$b"]'))
: $((++a["$b"]))
But yes, this does seem like a bug.
On Mon, Aug 29, 2016 at 5:57 PM, Jarno Suni
wrote:
> declare -A a
> b="80's"
> ((++a[$b]))
> ((++a["$b"]))
> [[ $((++a[$b])) ]] || true
> [[ $((++a["$b"])) ]] || true # this finally works and makes the variable
> =1
> echo ${a["$b"]}
> echo ${a[$b]}
>
((++a[\$b]))
It's non-intuitive certainly,