13,420
edits
Changes
→Additional Logic Statements
<span style="font-family:courier;">num1=5<br>num2=10<br>if test $num1 –lt $num2<br>then<br> echo “Less Than”<br>else<br>echo “Greater Than or Equal to”<br>fi</span><br><br>
[[Image:if-elif-else.png|thumb|right|300px|Example of how an '''if-elif-else''' statement works.]]'''if-elif-else Statements�Statements'''
If the test condition returns a TRUE value, then the Linux Commands between <br>then and else statements are executed. �<br><br>If the test returns a FALSE value, then a new condition is tested, <br>and action is taken if the result is TRUE . Eventually, an action will be taken when the final test condition is FALSE�FALSE
Example:��
<span style="font-family:courier;">num1=5<br>num2=10<br>if test $num1 –lt $num2<br>then echo “Less Than”<br>elif test $num1 –gt $num2<br>then<br> echo “Greater Than”<br>else echo “Equal to”<br>fi</span><br><br>