Skip to content

Instantly share code, notes, and snippets.

@bench
Created February 7, 2018 20:50
Show Gist options
  • Save bench/c984c302aa000ae81136095188a14ffc to your computer and use it in GitHub Desktop.
Save bench/c984c302aa000ae81136095188a14ffc to your computer and use it in GitHub Desktop.
while and for loop syntax in bash
# While loop
while [ $i -lt 10 ];
do
[...]
done
# C style for loop
for (( c=1; c<=$MAX_VAL; c++ ))
do
[...]
done
# for...in loop
for var in $(seq 1 4)
do
[...]
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment