Changes

Jump to: navigation, search

Tutorial12: Shell Scripting - Part 2

61 bytes added, 08:51, 5 September 2020
Additional Logic Statements
[[Image:if-else.png|thumb|right|300px|Example of how an '''if-else''' statement works.]]'''if-else Statements'''
If When 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 the the Linux Commands between<br>the '''else ''' and '''fi ''' statements are executed.
'''Example:'''
<span style="font-family:courier;font-weight:bold;">num1=5<br>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</span><br><br>
[[Image:if-elif-else.png|thumb|right|300px|Example of how an '''if-elif-else''' statement works.]]'''if-elif-else Statements'''
13,420
edits

Navigation menu