Shell Scripting if then else
The if then else condition loop states that if condition meets, output goes to if part otherwise it goes to else part.
The word fi represents if loop termination .
Syntax of if then else is shown in the snapshot below,
Example if then else:
We have shown the example of voting. If user's age will be greater than 18 then he or she will be eligible to vote, otherwise not.
Look at the above snapshot, we have shown the script of file voter.
Look at the above snapshot, with age 17 it displays the message "you are younger !!" and with age 30 it displays the message "you are eligible to vote".