Skip to content

Instantly share code, notes, and snippets.

@damianwajer
Created January 5, 2021 12:37
Show Gist options
  • Save damianwajer/1d9a92fce9a12e25a2aa3f3ae3138b2a to your computer and use it in GitHub Desktop.
Save damianwajer/1d9a92fce9a12e25a2aa3f3ae3138b2a to your computer and use it in GitHub Desktop.
[Bash] Loop through strings in one line.
# Inline for loop
for i in "item1" "item2"; do echo "$i"; done
# Alternative syntax
for i in {"item1","item2"}; do echo "$i"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment