|
|
if
Conditionally perform a command. The test-commands list is executed, and if its return status is zero, the consequent-commands list is executed.
SYNTAX
if test-commands; then
consequent-commands;
[elif more-test-commands; then
more-consequents;]
[else alternate-consequents;]
fi
If test-commands returns a non-zero status, each elif
list is executed in turn, and if its exit status is zero, the corresponding
more-consequents is executed and the command completes.
If `else alternate-consequents' is present, and the
final command in the final if or elif clause has a
non-zero exit status, then alternate-consequents is executed.
The return status is the exit status of the last command executed, or zero if
no condition tested true.
Related commands:
case - Conditionally perform a command
expr - Evaluate expressions
eval - Evaluate several commands/arguments
for - Expand words, and execute commands
gawk - Find and Replace text within file(s)
m4 - Macro processor
until - Execute commands (until error)
while - Execute commands
Equivalent Windows NT commands:
IF - Conditionally perform a command