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. You can extend the IF command over several lines if you use it
interactively or in a Shell script. When you use IF interactively, and extend
the command over more than one line, the Shell prompts you for each new line
of the command with the $_ prompt (refer to the example below).
ARGUMENTS
command_1
(required) Specify a command or program to execute and test for truth,
or specify a variable expression or Boolean variable to
test for truth. "Truth" usually means that the command
executes successfully (without any errors), or that the
Shell variable expression or Boolean is "true".
(Specifically, this argument is evaluated TRUE if it
returns an abort severity level of 0 (zero).)
Refer to Chapter 3 of the DOMAIN System Command Reference
Manual for more information on Shell variables.
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).
EXAMPLES
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.