How do I write a for loop in bash

John Meagher picture John Meagher · Sep 8, 2008 · Viewed 103.4k times · Source

I'm looking for the basic loop like:

for(int i = 0; i < MAX; i++) {
  doSomething(i);
}

but for bash.

Answer

Rob Rolnick picture Rob Rolnick · Sep 8, 2008

From this site:

for i in $(seq 1 10);
do
    echo $i
done