Open main menu

CDOT Wiki β

Changes

Tutorial12: Shell Scripting - Part 2

440 bytes added, 08:55, 27 July 2020
Additional Logic Statements
===Additional Logic Statements===
x'''if-else Statements'''
If the test condition returns a TRUE value, then the Linux Commands between then and else statements are executed. �
If the test returns a FALSE value, then the the Linux Commands between the else and fi statements are executed.�
 
Example:
 
num1=5�num2=10<br>if test $num1 –lt $num2<br>then<br> &nbsp;&nbsp;&nbsp;echo “Less Than”<br>�else<br>echo &nbsp;&nbsp;&nbsp;“Greater Than or Equal to”<br>fi
===Additional Loop Statements===
13,420
edits