Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
;;<br />
2)<br />
$FORTUNE startrek<br />
;;<br />
3)<br />
$FORTUNE kernelnewbies<br />
;;<br />
4)<br />
echo "Sports are a waste of time, energy and money."<br />
echo "Go back to your keyboard."<br />
echo -e "\t\t\t\t -- \"Unhealthy is my middle name\" Soggie."<br />
;;<br />
5)<br />
$FORTUNE bofh-excuses<br />
;;<br />
6)<br />
$FORTUNE magic<br />
;;<br />
7)<br />
$FORTUNE love<br />
;;<br />
8)<br />
$FORTUNE literature<br />
;;<br />
9)<br />
$FORTUNE drugs<br />
;;<br />
10)<br />
$FORTUNE education<br />
;;<br />
0)<br />
echo "OK, see you!"<br />
break<br />
;;<br />
*)<br />
echo "That is not a valid choice, try a number from 0 to 10."<br />
;;<br />
esac<br />
done<br />
Mind that break exits the loop, not the script. This can be demonstrated by adding an echo command at the<br />
end of the script. This echo will also be executed upon input that causes break to be executed (when the user<br />
types "0").<br />
In nested loops, break allows for specification of which loop to exit. See the <strong>Bash</strong> info pages for more.<br />
9.5.2. The continue built-in<br />
<strong>Bash</strong> <strong>Guide</strong> for <strong>Beginners</strong><br />
The continue statement resumes iteration of an enclosing for, while, until or select loop.<br />
When used in a for loop, the controlling variable takes on the value of the next element in the list. When used<br />
in a while or until construct, on the other hand, execution resumes with TEST-COMMAND at the top of the<br />
loop.<br />
Chapter 9. Repetitive tasks 115