Please contact or Mt Xia for assistance with all your shell programming needs.
4. CONTROL CONSTRUCTS:
The BourneShell control constructs can alter the flow of control within the script. The BourneShell provides simple two-way branch if statements and multiple-branch case statements, plus for, while, and until statements. In discussing these control structures, the BourneShell keywords will be in bold type and the normal type are the user supplied items to cause the desired effect in command format boxes.4.1 Types of Tests Used with Control Constructs:
The test utility evaluates expressions and returns a condition indicating whether or not the expression is true (equal to zero) or false (not equal to zero). There are no options with this utility. The format for this utility is as follows:
Command Format: test expression expression - composed of constants, variables, and operators |
int1 op int2 |
Command Format: if expression then commands fi |
Command Format: if expression then commands else commands fi |
Command Format: if expression then commands elif expression then commands else commands fi |