In this section, we will consider shell loops in UNIX. A loop is a commanding programming tool that enables you to perform a set of commands constantly. In this section, we will observe the following types of loops available to shell programmers −
You will use different loops based on the situation. For example, the while loop executes the given commands until the given condition remains true; the until loop execute until a given condition becomes true.
Once you have good programming preparation you will gain the capability and thereby, start using suitable loop based on the situation. Here, while and for loops are accessible in most of the other programming languages like C, C++ and PERL, etc.
All the loops maintain nesting model which means you can put one loop inside another related one or different loops. This nesting can go up to infinite number of times based on your necessity.
Here is an instance of nesting while loop. The other loops can be nested based on the programming condition in a related way −
It is feasible to use a while loop as part of the body of another while loop.
Here is a simple instance of loop nesting. Let's add another countdown loop inside the loop that you used to count to nine –
This will construct the following result. It is main to note how echo -works here. Here -n option lets echo avoid printing a new line nature.
Unix/Linux Related Interview Questions
|Perl Scripting Interview Questions||Shell Scripting Interview Questions|
|Python Interview Questions||Core Java Interview Questions|
|Linux Interview Questions||Linux Embedded systems Interview Questions|
|Red Hat Linux System Administration Interview Questions||IBM AIX Interview Questions|
|Sybase Interview Questions||IBM AIX 7 Administration Interview Questions|
|Unix Shell Scripting Interview Questions||Linux Shell Scripting Interview Questions|
Unix/Linux Related Practice Tests
|Perl Scripting Practice Tests||Shell Scripting Practice Tests|
|Python Practice Tests||Core Java Practice Tests|
|Linux Practice Tests||Linux Embedded systems Practice Tests|
|Red Hat Linux System Administration Practice Tests||IBM AIX Practice Tests|
|Sybase Practice Tests||IBM AIX 7 Administration Practice Tests|
|Autosys Practice Tests|
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.