if else statement in shell script example
Example 1: if else statement example in shell script
if [ ... ]
then
# if-code
else
# else-code
fi
Example 2: bash if else if
if [[ TEST-COMMAND ]]
then
STATEMENTS1
else
STATEMENTS2
fi
if [ ... ]
then
# if-code
else
# else-code
fi
if [[ TEST-COMMAND ]]
then
STATEMENTS1
else
STATEMENTS2
fi