~ubuntu-branches/ubuntu/vivid/cctools/vivid

« back to all changes in this revision

Viewing changes to ftsh/test/loops.ftsh

  • Committer: Bazaar Package Importer
  • Author(s): Michael Hanke
  • Date: 2011-05-07 09:05:00 UTC
  • Revision ID: james.westby@ubuntu.com-20110507090500-lqpmdtwndor6e7os
Tags: upstream-3.3.2
ImportĀ upstreamĀ versionĀ 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#
 
3
# Print three words separately
 
4
#
 
5
 
 
6
for name in three blind mice
 
7
        echo ${name}
 
8
end
 
9
 
 
10
#
 
11
# Treat each word in the variable separately
 
12
#
 
13
 
 
14
WORDS="four fat cats"
 
15
for name in ${WORDS}
 
16
        echo ${name}
 
17
end
 
18
 
 
19
#
 
20
# Treat the variable as one word
 
21
#
 
22
 
 
23
for name in "${WORDS}"
 
24
        echo ${name}
 
25
end
 
26
 
 
27
#
 
28
# Build a multiplication table.
 
29
#
 
30
 
 
31
for i in 1 2 3 4 5 6 8 9
 
32
        for j in 1 2 3 4 5 6 7 8 9
 
33
                k=${i} .mul. ${j}
 
34
                printf "%02d " ${k}
 
35
        end
 
36
        echo ""
 
37
end
 
38