Home
Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

Create And Loop Through An Array Of Strings In Bash

If all the values you're working with are single words you can process them as a string. See : 2so4kki3

This is how to create an array

bash
NAMES=("alfa bravo" "charlie delta" "echo foxtrot")

for name in "${NAMES[@]}"; do
  echo $name
done
results full

- Don't put commas between items in the array or they'll show up in the output. (i.e. don't do "alfa bravo", "charlie delta")

- The quotes around ` ${NAMES[@]} [TODO: Code shorthand span ] are necessary to keep the strings from splitting on spaces

Footnotes And References