Is there a way to get size of associative array in bash:
declare -A array
...without iterating through the elements?
The size of interest is both: just number of elements, and memory amount it consumes?
${#array[@]}
would return you the size of the array.
$ declare -A array
$ array[foo]='something'
$ array[bar]='blah'
$ array[42]='nothing'
$ echo ${#array[@]}
3