Until Statement Assignment Help

Assignment Help: >> Advanced Shell Scripts - Until Statement

The Until Statement

This statement is extremely same in syntax and function to the while statement. The difference among the two statements which is, the until statement executes its code block although its conditional expression is false and the while statement executes its code block although its conditional expression is true.

until [ condition ]

do commands

done

Practice 1

The given shell program lists the parameters which were passed to the program, with parameter number

count=1

until [ -n "$*" ]

do

echo "This is a parameter number $count $1"

shift

count='expr $count + 1'

done

# sh while 1 2 3 4 5 6

This is a parameter number 1 1

This is a parameter number 2 2

This is a parameter number 3 3

This is a parameter number 4 4

This is a parameter number 5 5

This is a parameter number 6 6

The given program will accept the arguments and show the respective position of each argument or parameter. In the program the shift command has been used to shift the parameter to the next position.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd