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

Date: 2020-03-15

Tags:  bash

Share: