While Statement Assignment Help

Assignment Help: >> Advanced Shell Scripts - While Statement

While statement

This statement is another iteration statement which is offered through the shell programming language. While statement causes a block of code to be executed although a provided conditional expression is true.

Syntax

while [ command-list1 ]

do

done

command-list2

The value tested through the while command is the exit status of the final simple command following while. After the each iteration command-list1 is executed; if a zero exit status is returned then command-list2 is executed; else, the loop terminates. For instance,

while test $1

do ...

shift

done

is equivalent to for i

do ...

done

shift is a shell command which renames the positional parameters $2, $3, ... as $1, $2, ... and loses   the parameter $1. In the given example the shift command moves the command-line parameters to the left through one parameter.

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