Testing for Conditions
When writing scripts, you frequently want to test for conditions. The simplest test is to determine whether a condition is true or false. If the expression is true, execute any subsequent commands (shown indented in Table 90); if not, continue with the script. Table 90 shows the syntax for conditional tests.
Bourne and Korn Shells | C Shell |
---|---|
if command then commands elif command commands else commands fi |
if (cond) then commands else if (cond) then commands else commands endif |
if-then-else-elif
For the Bourne and Korn shells, use the if-then-else-elif-fi syntax to test for conditions. You can follow the if statement with the test command and its argument(s) to test for conditions. ...
Get Solaris™ 8 Advanced System Administrator's Guide, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.