Changes

Jump to: navigation, search

Tutorial12: Shell Scripting - Part 2

533 bytes added, 07:51, 18 March 2021
EXIT & BREAK STATEMENTS
====EXIT & BREAK STATEMENTS====
'''Exit <span style="font-family:courier;font-weight:bold;">exit</span> Statement'''
The '''exit''' statement is used to '''terminate''' a shell script.
fi<br>
</code>
 
<br><br>
'''<span style="font-family:courier;font-weight:bold;">break</span> Statement'''
 
The '''break''' statement is used to terminate a loop.<br>
Although the loop terminates, the shell script will continue running.�
 
''Example:�''
<cod>
read -p "Enter a number: " number<br>
while [ $number -ne 5 ]<br>
do<br>
   read -p "Try again. Enter a number: " number<br>
   if [ $number -eq 5 ]<br>
   then<br>
     break<br>
   fi<br>
done<br>
</code>
<br><br>
===START-UP FILES===
13,420
edits

Navigation menu