On Wed, Feb 4, 2015 at 4:12 PM, isabella parakiss <izaber...@gmail.com> wrote: > This produces an error: > $ declare -A array; unset array[@]; array[path/directory]=value > bash: path/directory: division by 0 (error token is "directory") > > After unsetting all its elements, the array is not associative anymore?
Logically that should only unset the elements of an array and not the array variable itself since '*' or '@' is more of a wildcard that represents the indices. However, bash does otherwise: #define ALL_ELEMENT_SUB(c) ((c) == '@' || (c) == '*') ... if (ALL_ELEMENT_SUB (sub[0]) && sub[1] == 0) // If substring is just '@' or '*' { unbind_variable (var->name); // It just removes it. return (0); } Bash version is 4.3.33.