blob: daeef24330fe8b424b7bc25b8ff9354335357cc5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
for file in " foo bar "
do
echo $file
done
for foo in abc def ghi
do
echo $foo
done
for (( i=1; i<4; ++i ))
do
echo $i
done
for ((;i<10;))
do
echo $((++i))
done
for ((;i<0;))
do
echo "Shouldn't print this"
done
i=0;
while [ $i != 4 ]
do
i=$(( i + 1 ))
echo $i
done
while [ $i \< 0 ]
do
echo "Shouldn't print this"
done
i=0;
until [ $i == 4 ]
do
i=$(( i + 1 ))
echo $i
done
until [ $i \> 0 ]
do
echo "Shouldn't print this"
done
a=1
b=2
if [ $a == $b ]
then
echo "Shouldn't print this"
fi
if [ $a != $b ]
then
echo $a
fi
if [ $a == $b ]
then
echo "Shouldn't print this"
elif [ $a != $b ]
then
echo $b
fi
if [ $a == $b ]
then
echo "Shouldn't print this"
else
echo $a
fi
if [ $a == $b ]
then
echo "Shouldn't print this"
elif [ $a == $b ]
then
echo "Shouldn't print this"
else
echo $a
fi
target=123
case $target in
1.3)
echo "Shouldn't print this"
;;
\d+)
echo "Shouldn't print this"
;;
456|1?*|789)
echo yep
;;
123)
echo "Shouldn't print this"
;;
esac
target=xyz
case $target in
bcd)
echo "Shouldn't print this"
;;
abc)
echo "Shouldn't print this"
;;
*)
echo "default"
;;
esac
target=a
case $target in
[def])
echo "Shouldn't print this"
;;
[abc])
echo yep
;;
esac
case $target in
[def])
echo "Shouldn't print this"
;;
[a])
echo yep
;;
esac
case $target in
[!abc])
echo "Shouldn't print this"
;;
[!def])
echo yep
;;
esac
case $target in
[d-z])
echo "Shouldn't print this"
;;
[a-c])
echo yep
;;
esac
case $target in
[!a-c])
echo "Shouldn't print this"
;;
[!d-z])
echo yep
;;
esac
target=bar
case $target in
a[a-cx-z]r)
echo "Shouldn't print this"
;;
b[!d-fx-z]r)
echo yep
;;
esac
target="a"
case $target in
[[:alnum:][:alpha:][:ascii:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:word:][:xdigit:]])
echo yep
;;
esac
target="a"
case $target in
[[:ascii:]])
echo yep
;;
esac
target="_"
case $target in
[[:word:]])
echo yep
;;
esac
echo "case end"
|