Terms of Service Privacy Policy Contact Us

leistware.com

Flow Control

The For, Do... Done!


for x in 1 2 3 4 5
do
   # some processing...
done

The For loop is the most used looping construct when there is a specified set to iterate over.

CREATED 2017-08-23 16:33:59.0

00-2A-7C

UPDATED 2017-08-23 16:34:21.0

The While, Do... Done!


x=1
while [ x -le 10 ] <-- Make sure there is a space between the brackets and anything else
do
   # some processing
done

The while do done is another one of the useful loop constructs in bash. When the loop is bases on a condition or breaking out will be determined during the loop, the while, do done is your construct.

CREATED 2017-08-23 16:39:17.0

00-2A-7D

UPDATED 2017-08-31 23:32:09.0

Knowledge

Page Server: Ithica

DBID: db.wam

©2012 Leistware Data Systems

      Hello anonymous