4.0; if, revision 5.0, 82/10/07
IF -- Execute a conditional statement.
usage: IF command_1 THEN command_2 [ELSE command_3...] ENDIF
FORMAT
If command_1 THEN command_2 ... [ELSE command_3 ...] ENDIF
IF executes a conditional statement depending on the results of a Boolean
test. In a Shell script, the IF command may extend over several lines;
interactively, it must appear in a single command line. (Use @<RETURN> to
continue long interactive command lines.)
ARGUMENTS
command_1
(required) Specify command or program to execute and test for truth.
"Truth" usually means that the command executes
successfully, without any errors. Specifically, this
argument is evaluated TRUE if it returns an abort severity
level of 0 (zero).
command_2
(required) Specify command or program to execute if command_1 returns
TRUE.
command_3
(optional) Specify command or program to execute if command_1 returns
FALSE (i.e., a severity level greater than zero).
EXAMPLE
1. $ IF eqs a a THEN args "a is a" ELSE args "Aristotle was wrong." ENDIF
a is a
$
2. $ IF eqs ^2 '-c' THEN pas ^1 ELSE bind ^1.bin library -b ^1 ENDIF
Example 2 will compile the Pascal module named by the first argument (^1) if
the second argument (^2) is '-c'. Then it will bind the module with
'library'. If the second argument is not '-c', or if there is no second
argument, the command simply binds the module.
RELATED TOPICS
More information is available. Type:
- HELP ABTSEV
for information about abort severity levels.