Difference between revisions of "Bash for loop"

From thelinuxwiki
Jump to: navigation, search
(Pushed from thelinuxwiki.com.)
 
Line 11: Line 11:
 
     echo "the i is $i"
 
     echo "the i is $i"
 
  done
 
  done
 
+
 
+
 
[[category:bash]]
 
[[category:bash]]

Revision as of 01:26, 12 May 2013

Example:

 for i in {1..5}
 do
   echo "Welcome $i times"
 done


portable for loop (for older bash versions)

for i in `seq 10`
do
   echo "the i is $i"
done