I am Aaditya Purani ,If statements (and, closely related, case statements) allow us to make decisions in our Bash scripts. They allow us to decide whether or not to run a piece of code based upon conditions that we may set. If statements, allow us to make much more complex scripts which may solve larger tasks.
Sometimes we want to perform a certain set of actions if a statemen is true, and another set of actions if it is false. We can accommodate this with the else mechanism.
echo “Hey dude. Which color you like”
if [ $color = “red” ]
echo “Correct one man”
elif [ $color = “green” ]
echo “Pretty nice guess”
echo “Sorry duh”