|
From: | Oğuz |
Subject: | No expansions performed while declaring an associative array using a list of keys and values |
Date: | Fri, 11 Dec 2020 15:08:04 +0300 |
I was trying the new features of bash 5.1 and came across this inconsistent behavior: $ foo='1 2' $ declare -A bar=($foo 3) $ declare -p bar declare -A bar=(["\$foo"]="3" ) $ $ bar+=($foo 3) $ declare -p bar declare -A bar=(["\$foo"]="3" ["1 2"]="3" ) Is there a particular reason to avoid performing expansions in `declare -A bar=($foo 3)'? Oğuz
[Prev in Thread] | Current Thread | [Next in Thread] |