4.0;if, revision 5.0, 82/10/07
IF -- Execute a conditional statement.
usage: IF condition THEN command_1 [ELSE command_2...] ENDIF
FORMAT
IF condition THEN command_1 ... [ELSE command_2 ...] 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
condition
(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 the DOMAIN System User's Guide for more
information on Shell variables.
command_1
(required) Specify command or program to execute if 'condition'
returns TRUE.
command_2
(optional) Specify command or program to execute if 'condition'
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
bind ^1.bin library -b ^1
ELSE bind ^1.bin library -b ^1
ENDIF
Example 2 might appear in a Shell script. These lines 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.