...

/

Bash conditional statements

Bash conditional statements

We'll cover the following...

Bash if-else

To compare integers we use can the following operators:

Operator Description
-eq Equal to
-ne Not equal to
-gt Greater than
-ge Greater than OR equal to
-lt less than
-le less than OR equal to

The following example shows how to use the number comparison operators in an if statement.

Press + to interact
main.sh
bash-ifelse.sh
bash bash-ifelse.sh 0

Bash elif is ...