Conditional Statements: There are total 5 conditional statements which can be used in bash programming
if statement
if-else statement
if..elif..else..fi statement (Else If ladder)
if..then..else..if..then..fi..fi..(Nested if)
switch statement




Here are some useful examples of if-else in shell scripts to give you a better idea of how to use this tool.
| Command | Description |
| && | Logical AND |
| $0 | Argument 0 i.e. the command that’s used to run the script |
| $1 | First argument (change number to access further arguments) |
| -eq | Equality check |
| -ne | Inequality check |
| -lt | Less Than |
| -le | Less Than or Equal |
| -gt | Greater Than |
| -ge | Greater Than or Equal |
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at Cotocus. I share tech blog at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow , and SEO strategies at Wizbrand.
Do you want to learn Quantum Computing?
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at WIZBRAND