Bash Associative arrays

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9

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


Got any Bash Question?