Back to cheatsheets

Shell

Iterate over array in Bash

#!/bin/bash
 
items=(
    "A"
    "B"
    "C"
)
 
for idx in "${items[@]}"
do
    echo "$idx";
done