BashAssociative arrays


Syntax

  • declare -A assoc_array # without initializing
  • declare -A assoc_array=( [key]="value" [another key]="mind the spaces" [ three spaces ]="all blanks sum up")
  • echo ${assoc_array[@]} # the values
  • echo ${!assoc_array[@]} # the keys