About sh

Dev shell sh

Associative arrays in non-bash shells

Bash 4 introduced the ability to declare and deal with associative arrays in a very pythonistic way, like so:

declare -A some_array        # create the array
some_array[key] = 1          # put value
echo ${some_array[key]}      # get value 

Hooray! However, depending on the context, bash 4 or even older bash …

Page 1 / 1