Some of the conditional statements in Linux are-
1) if..then..fi statement (Simple If)
2) if..then..else..fi statement (If-Else)
3) if..elif..else..fi statement (Else If ladder)
4) if..then..else..if..then..fi..fi..(Nested if
1) Bash If..then..fi statement
Syntax:
if [ conditional expression ]
then
statement1
statement2
Fi
2) Bash If..then..else..fi statement
Syntax:
If [ conditional expression ]
then
statement1
statement2
else
statement3
statement4
Fi
Example:
3) Bash If..elif..else..fi
Syntax:
If [ conditional expression1 ]
then
statement1
statement2
elif [ conditional expression2 ]
then
statement3
statement4
else
statement5
fi
Example:
4) Bash If..then..else..if..then..fi..fi..
Syntax:
If [ conditional expression1 ]
then
statement1
statement2
else
if [ conditional expression2 ]
then
statement3
fi
fi
Example: