Continue Statement Assignment Help

Assignment Help: >> Advanced Shell Scripts - Continue Statement

Continue Statement

The continue command is just like the break command. Continue statement causes the execution to come out of the loop. But as like break that causes the execution to continue after the loop, to execute the continue statement causes the loop from the next iteration.

Practice 

The given shell program if a given number is greater than 1000 or not.

$ cat > until until false

do

echo "enter a number less than 1000:"

read nm

if [ $nm -ge 1000 ]

then continue

else

echo "The number is $num"

fi done

Explanation

In the given program if a number less than 1000 is entered which number is displayed and program exits. In the other case if the number is greater than 1000 then the program encounters the continue statement and the program repeats prompting the user to enter a number less than 1000. This procedure continues till the users enter a number less than 1000.

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