if

Conditionally perform a command.

Syntax
        if list; then list; [ elif list; then list; ] ... [ else list; ] fi


The if list is executed. If its exit status is zero, the then list is executed.

Otherwise, each elif list is executed in turn, and if its exit status is zero, the corresponding then list is executed and the command completes. Otherwise, the else list is executed, if present.

The exit status is the exit status of the last command executed, or zero if no condition tested true.)

if is a bash builtin command.

"Then you admit confirming not denying you ever said that?"
"NO! ... I mean Yes! WHAT?"
I'll put `maybe' - Bloom County

Related:


awk - Find and Replace text within file(s)
eval - Evaluate several commands/arguments
expr - Evaluate expressions
for - Loop command
switch - Conditionally perform a command
while - Loop command



Back to the Top

© Copyright SS64.com 1999-2012
Some rights reserved