blob: 4fa30ff90143a7cb5feefd9032998561d7530cd0 [file] [log] [blame]
Denis Vlasenko1c660b42007-03-05 00:27:50 +00001fx()
2{
3i=0
4for (( ; i < 3; i++ ))
5do
6 echo $i
7done
8
9for (( i=0; ; i++ ))
10do
11 if (( i >= 3 )); then
12 break;
13 fi
14 echo $i
15done
16
17for (( i=0; i<3; ))
18do
19 echo $i
20 (( i++ ))
21done
22
23i=0
24for (( ; ; ))
25do
26 if (( i > 2 )); then
27 break;
28 fi
29 echo $i;
30 (( i++ ))
31done
32
33i=0
34for ((;;))
35do
36 if (( i > 2 )); then
37 break;
38 fi
39 echo $i;
40 (( i++ ))
41done
42}
43
44for (( i=0; "i < 3" ; i++ ))
45do
46 echo $i
47done
48
49i=0
50for (( ; "i < 3"; i++ ))
51do
52 echo $i
53done
54
55for (( i=0; ; i++ ))
56do
57 if (( i >= 3 )); then
58 break;
59 fi
60 echo $i
61done
62
63for ((i = 0; ;i++ ))
64do
65 echo $i
66 if (( i < 3 )); then
67 (( i++ ))
68 continue;
69 fi
70 break
71done
72
73type fx
74fx
75
Denis Vlasenkoc86e0522007-03-20 11:30:28 +000076# errors
Denis Vlasenko1c660b42007-03-05 00:27:50 +000077for (( i=0; "i < 3" ))
78do
79 echo $i
80done
81echo $?
82
83for (( i=0; i < 3; i++; 7 ))
84do
85 echo $i
86done
87echo $?
88
89# one-liners added in post-bash-2.04
90for ((i=0; i < 20; i++)) do : ; done
91echo $i
92
93for ((i=0; i < 20; i++)) { : ; }
94echo $i