Hitachi

Job Management Partner 1 Version 10 Job Management Partner 1/Advanced Shell Description, User's Guide, Reference, and Operator's Guide


while statement (loops while a condition is true)

Organization of this page

Format 1

while condition
do
        processing
done

Format 2

while condition;do
        processing
done

Summary

This control statement executes specified processing repeatedly as long as a specified condition is true.

Description

This statement begins with while, followed by do, and ends with done. A condition can be any command or a group of commands combined using operators such as &&, ||, ( ), and { }. The processing described between do and done is performed repeatedly as long as the return code from executing the command or the command group specified as the condition is 0. To exit from the while statement, there must be a change created by the processing described between do and done such that the condition ceases to be true.

do and done cannot be omitted. Without a matching pair of do and done, the syntax is invalid and the statement will terminate with an error.

If you specify a semicolon (;) immediately after condition, you can continue specifying the statement on the same line.

Usage example