Hitachi

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


for statement (repeats the same processing)

Organization of this page

Format 1

for variable [in wordlists]
do
        processing
done

Format 2

for variable [in wordlists];do
        processing
done

Summary

This control statement repeats the same processing while incrementing a value.

Description

This statement begins with for, followed by do, and ends with done. The number of times the loop is executed is determined by the number of elements in wordlists. The processing described between do and done is executed while variable is successively assigned to each element of wordlists, starting from the left. After all the elements of wordlists have been assigned, the for statement terminates.

The elements of wordlists are delimited by a whitespace and identified as element-1 element-2 ...element-n.

When a variable is specified in wordlists, even if the value of the specified variable changes between do and done, the value assigned to the variable in the for statement remains unchanged.

If $@ is specified for wordlists, the arguments to the job definition script are used as the values of wordlists. Omitting in wordlists is the same as specifying $@ for wordlists (in $@).

You can specify a left curly bracket ({) instead of do, and you can specify a right curly bracket (}) instead of done. If you use do, you must also use done; if you use {, you must also use }. If these specifications are not paired in this way, the syntax will be invalid and the control statement will terminate with an error.

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

Usage example