Skip to content

Instantly share code, notes, and snippets.

@antonioiksi
Forked from bench/while_for_syntax_bash.sh
Created September 15, 2020 18:15
Show Gist options
  • Save antonioiksi/ace3352816e4f99494f8073ce4575dc6 to your computer and use it in GitHub Desktop.
Save antonioiksi/ace3352816e4f99494f8073ce4575dc6 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