On 12/16/20 10:58 AM, Glenn Jackman wrote:
On 2020-12-15 16:58, Chet Ramey wrote:
On 12/15/20 11:23 AM, Glenn Jackman wrote:
I would think that these pairs of invocations would correspond:
declare -A v1=$( $foo 3 )
declare -A v1=$( [1]=2 [3]="")
declare -A v1=$( "$foo" 3 )
declare -A v1=$( ['1 2']=3 )
Do word splitting and quote removal not occur within the parentheses of an
_associative_ array definition?
Associative array keys do not undergo word splitting on assignment, whether
they are used in a subscript or the alternate key-value synatx. This has
been the case since their introduction in bash-4.0.
Ah, that's the bit I was missing. Thank you for taking the time to
clarify. I don't see that documented in the manual though. Where did I
miss it?
It's not stated explicitly; it simply does not make sense to do it any
other way.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/