On 18/07/2019 14:12, Greg Wooledge wrote:
On Thu, Jul 18, 2019 at 10:58:52AM +0200, Henning wrote: eval 'foo=(["key"]="'"${foo["key"]}"' value2")' If you just want to work around the bug, why not do it in the simplest way possible? foo["key"]+=" value2" Of course, you are right.
Can be done safely with storing the intermediate value. declare -A foo foo=(["key"]="value1") declare -p foo _v="${foo["key"]}" declare -p _v foo=(["key"]="${_v} value2") declare -p foo Still safer than eval for an extra intermediary assignment.And allow you to insert the old value of ${foo=["key"]} anywhere in-between. The += string concatenation would not work in this case.
-- Léa Gris
signature.asc
Description: OpenPGP digital signature