Arrays in bash


My cheatsheet for dealing with bash arrays, since I can never remember the exact syntax for them.

Loop through:

for val in "${arrayName[@]}"
do
   # do whatever on $val
done

Length:

${#arrayName[@]}

source

Tags:  bash

Share: