How to pass an associative array as argument to a function in Bash?
How do you pass an associative array as an argument to a function? Is this possible in Bash? The code below is not working as expected: function iterateArray { local ADATA="${@}" # associative array for key in "${!ADATA[@]}" do echo "key - ${key}" echo "value: ${ADATA[$key]}" done } Passing associative arrays to a function like normal arrays does not work: iterateArray "$A_DATA" or iterateArray "$A_DATA[@]" Florian Feldhaus I had exactly the same problem last week and thought about it for quite a while. It seems, that associative arrays can't be serialized or copied. There's a good Bash FAQ