13,420
edits
Changes
→Additional Loop Statements
''Example:''
<span style="font-family:courier;font-weight:bold;">for x in $(ls)<br>do<br> echo “The item is: $x”<br>done</span><br><br>
[[Image:while-loop.png|thumb|right|170px|Example of how a '''while''' loop works.]]'''Using the while Loop Statement'''
''Example:''
<span style="font-family:courier;font-weight:bold">answer=10<br>read –p “pick a number between 1 and 10: “ guess<br>while test $guess –eq 10<br>do read –p “Try again: “ guess<br>done<br>echo “You are correct”</span><br><br>
===Using Startup Files===