Quantcast
Channel: » AIX
Viewing all articles
Browse latest Browse all 12

Unix Shell Script : While Loop

$
0
0
The general syntax as follows for “bash while loop” : while [ CONTROL-COMMAND ]; do CONSEQUENT-COMMANDS; done while [ CONDITION ] do     command1     command2     commandN done Where : CONTROL-COMMAND or CONDITION can be any command, program, script or shell construct that can exit with a success or failure status. As soon as the CONTROL-COMMAND fails, the loop exits. CONSEQUENT-COMMANDS : The CONDITION is evaluated, and if the condition is true, the CONSEQUENT-COMMANDS are executed. This repeats until the condition becomes false. The return status is the exit status of the last CONSEQUENT-COMMANDS command, or zero if none was executed. Examples : Example 1 : Simple Script with while loop for posting output for five...

Viewing all articles
Browse latest Browse all 12

Trending Articles