Skip to content

Instantly share code, notes, and snippets.

@odadoda
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odadoda/9273126 to your computer and use it in GitHub Desktop.
Save odadoda/9273126 to your computer and use it in GitHub Desktop.
# for-each
MY_ARRAY=("one", "two", "three")
for i in MY_ARRAY ; do
echo $i
done
# extended for-loop
for (( i=0; i "-lt" 3; i++ )) ; do
echo $i
done
# or use seq command to generate the incrementet variable
for i in `seq 1 3` ; do echo $i ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment