Bash Associative arrays

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

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?