The Linux operating system supports the following iteration constructs:
while
until
for
The following sections describe while,for, and untilconstructs.
on the value of the
Note: A loop is a block of code that repeats a set of commands based
specified conditión.
The while Construct
the constructs that you use to create loops in shell scripts is the while construct. In
ve or are specified within the do and
the commands to be executed
G Wile iteration construct, to delimit commands in an iteration
done keywords. The do and done keywords are used
Construct. The syntax for the while construct is:
, Syntax
while <condition>
do
<command (s)>
done
In the above example, the commands within the do and done keywords are executed as long
as the condition evaluates to true.
Examples
a. #!/bin/bash
a=l
while [ $a -le 10 ]
do
echo $a
((a=^a+l))
done
while
until
for
The following sections describe while,for, and untilconstructs.
on the value of the
Note: A loop is a block of code that repeats a set of commands based
specified conditión.
The while Construct
the constructs that you use to create loops in shell scripts is the while construct. In
ve or are specified within the do and
the commands to be executed
G Wile iteration construct, to delimit commands in an iteration
done keywords. The do and done keywords are used
Construct. The syntax for the while construct is:
, Syntax
while <condition>
do
<command (s)>
done
In the above example, the commands within the do and done keywords are executed as long
as the condition evaluates to true.
Examples
a. #!/bin/bash
a=l
while [ $a -le 10 ]
do
echo $a
((a=^a+l))
done