I’m at a loss why this loop stops after the first item. Can someone point me in a direction? Thanks!
#! /bin/sh
colors[0]="teal"
colors[1]="purple"
colors[2]="pink"
colors[3]="red"
colors[4]="green"
colors[5]="darkblue"
colors[6]="skyblue"
for color in ${colors}
do
echo $color
done
Try changing it to the following:
Removing the quotes would work for your example, but not if there were any spaces in a single color (for example
"sky blue").