13,420
edits
Changes
→INVESTIGATION 3: exit AND break STATEMENTS
# Confirm that you are currently located in the '''advanced''' directory.<br><br>
# Use a text editor like vi or nano to create the text file called '''break-1.bash''' (eg. <span style="color:blue;font-weight:bold;font-family:courier;">vi break-1.bash</span>)<br><br>
# Enter the following lines in the '''exit.bash''' shell script:<br><span style="font-family:courier;font-weight:bold;">#!/bin/bash<br><br>read -p "Enter a number: " number<br>while [ $number -ne 5 ]<br>do<br> read -p "Try again. Enter a number: " number<br>exit 1 if [ $number -eq 5 ]<br>then<br><br>fi break<br> fi<br>echo "The argument is: $1"done</span><br><br>
# Save your editing session and exit the text editor (eg. with vi: press '''ESC''', then type ''':x''' followed by '''ENTER''').<br><br>
# '''Add execute permissions''' for this Bash shell script.<br><br>