Created
January 5, 2021 12:37
-
-
Save damianwajer/1d9a92fce9a12e25a2aa3f3ae3138b2a to your computer and use it in GitHub Desktop.
[Bash] Loop through strings in one line.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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