~ubuntu-branches/ubuntu/natty/abs-guide/natty

« back to all changes in this revision

Viewing changes to abs/ex28.sh

  • Committer: Bazaar Package Importer
  • Author(s): Sandro Tosi
  • Date: 2010-05-09 17:49:52 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100509174952-1s583w0zbh7rl1po
Tags: 6.2-1
* New upstream release; Closes: #441278
* debian/control
  - adopting package; Closes: #577181
  - removed bzip2 from b-d-i, no more needed
  - debhelper has to be in b-d
  - bump Standards-Version to 3.8.4 (no changes needed)
  - added Homepage field
  - added misc:Depends to Depends
  - added Vcs-{Browser, Git} field
* debian/rules
  - removed the unpacking stuff, we now use an alrqady unpacked source
  - added more example scripts to fix
* debian/{compat, control, rules}
  - switched to debhelper 7
* debian/watch
  - updated to new upstream location; thanks to Raphael Geissert for the
    report; Closes: #453596
* debian/copyright
  - updated with new location and copyright/license notices
* debian/source/format
  - set source package format to 1.0 explicitly
* debian/abs-guide.doc-base
  - set Section field correctly
* debian/{copyright, abs-guide.doc-base}
  - updated upstream email
* debian/abs-guide.lintian-overrides
  - added override for "known syntax-errored" scripts

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
LIMIT=19  # Upper limit
 
4
 
 
5
echo
 
6
echo "Printing Numbers 1 through 20 (but not 3 and 11)."
 
7
 
 
8
a=0
 
9
 
 
10
while [ $a -le "$LIMIT" ]
 
11
do
 
12
 a=$(($a+1))
 
13
 
 
14
 if [ "$a" -eq 3 ] || [ "$a" -eq 11 ]  # Excludes 3 and 11.
 
15
 then
 
16
   continue      # Skip rest of this particular loop iteration.
 
17
 fi
 
18
 
 
19
 echo -n "$a "   # This will not execute for 3 and 11.
 
20
done 
 
21
 
 
22
# Exercise:
 
23
# Why does the loop print up to 20?
 
24
 
 
25
echo; echo
 
26
 
 
27
echo Printing Numbers 1 through 20, but something happens after 2.
 
28
 
 
29
##################################################################
 
30
 
 
31
# Same loop, but substituting 'break' for 'continue'.
 
32
 
 
33
a=0
 
34
 
 
35
while [ "$a" -le "$LIMIT" ]
 
36
do
 
37
 a=$(($a+1))
 
38
 
 
39
 if [ "$a" -gt 2 ]
 
40
 then
 
41
   break  # Skip entire rest of loop.
 
42
 fi
 
43
 
 
44
 echo -n "$a "
 
45
done
 
46
 
 
47
echo; echo; echo
 
48
 
 
49
exit 0