On Mon, Aug 29, 2016 at 5:57 PM, Jarno Suni <[email protected]>
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, but let commands don't get evaluated until
after the shell handles variable expansion.
Actually, that raises an interesting question about the differences between
$(( and ((. The man page says that $(( treats its contents as double
quoted, however, (( is a built-in an not an expansion. How does (( treat
its contents?
)) )) )) )) )) *grumblegrumbleunterminatedparensgrumble*