by @CodingExample

For loop in Bash script

Home » bash » For loop in Bash script

for loop is used to iterate over a list of items until a particular condition is true.

The following example will show you how to write a for loop in bash script.

for ((i = 0 ; i < 10 ; i++ ));
  echo "$i";

In the above code, the for loop starts from 0 and runs up to i<10 on each iteration we are incrementing the i value by 1.