if execute conditionally a block with a list of command based on the exit status of a list of command
You can also use control operators to run conditionally a command
if list; then
list;
[ elif list; then list; ]...
[ else list; ]
fi
Nested if example
if lists;
then
...
else
if lists;
then
# code if 'expression' is true.
fi
fi
The exit status of the entire construct is:
With a conditional expression command
if [ "foo" = "foo" ]; then
echo expression evaluated as true
else
echo expression evaluated as false
fi
help if