Le 22/10/2010 14:56, Chet Ramey a écrit :
And you're trying to redeclare it as an associative array here. The variable already exists; you can't convert it between array types; and bash tells you this. If you want an associative array, unset the variable before you declare it.
After your answer, I checked and I think the error message is not related to the variable name collision :
[a...@axel-asus plugins]$ unset foo [a...@axel-asus plugins]$ func() > { > echo "[a]=5 [b]=10" > } [a...@axel-asus plugins]$ declare -A foo=( $(func) ) -bash: foo: [a]=5: must use subscript when assigning associative array -bash: foo: [b]=10: must use subscript when assigning associative array [a...@axel-asus plugins]$ echo ${foo[a]} [a...@axel-asus plugins]$ declare -a bar=( $(func) ) [a...@axel-asus plugins]$ echo ${bar[0]} [a]=5