File: arith.right

package info (click to toggle)
bash 5.3-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 43,860 kB
  • sloc: ansic: 134,738; sh: 8,866; yacc: 5,966; makefile: 4,697; perl: 4,105; asm: 48; awk: 23; sed: 16
file content (369 lines) | stat: -rw-r--r-- 6,970 bytes parent folder | download
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
163
166
4
16
8
2
4
2
2
1
0
0
0
1
1
2
-3
-2
1
0
2
131072
29
33
49
1
1
0
0
1
1
1
2
3
1
58
2
60
1
256
16
62
4
29
5
-4
4
1
32
32
1
1
32
32
4
20
1,i+=2
30
1,j+=2
20
1,i+=2
30
1,j+=2
./arith.tests: line 129: 1 ? 20 : x+=2: attempted assignment to non-variable (error token is "+=2")
20
6
6,5,3
263
255
255
127
36
40
40
40
10
10
10
10
10
10
36
36
62
63
./arith.tests: line 168: 3425#56: invalid arithmetic base (error token is "3425#56")
./arith.tests: line 171: 2#: invalid integer constant (error token is "2#")
./arith.tests: line 174: 7 = 43 : attempted assignment to non-variable (error token is "= 43 ")
./arith.tests: line 175: 2#44: value too great for base (error token is "2#44")
./arith.tests: line 176: 44 / 0 : division by 0 (error token is "0 ")
./arith.tests: line 177: let: jv += $iv: arithmetic syntax error: operand expected (error token is "$iv")
./arith.tests: line 178: jv += $iv : arithmetic syntax error: operand expected (error token is "$iv ")
./arith.tests: line 179: let: rv = 7 + (43 * 6: missing `)' (error token is "6")
./arith.tests: line 182: b / 0 : division by 0 (error token is "0 ")
./arith.tests: line 183: b /= 0 : division by 0 (error token is "0 ")
./arith.tests: line 188: 0#4: invalid number (error token is "0#4")
./arith.tests: line 189: 2#110#11: invalid number (error token is "2#110#11")
abc
def
ghi
ok
6
1
0
./arith.tests: line 207: 4 + : arithmetic syntax error: operand expected (error token is "+ ")
16
./arith.tests: line 212: 4 ? : 3 + 5 : expression expected (error token is ": 3 + 5 ")
./arith.tests: line 213: 1 ? 20 : `:' expected for conditional expression (error token is "20 ")
./arith.tests: line 214: 4 ? 20 : : expression expected (error token is ": ")
9
./arith.tests: line 220: 0 && B=42 : attempted assignment to non-variable (error token is "=42 ")
9
./arith.tests: line 223: 1 || B=88 : attempted assignment to non-variable (error token is "=88 ")
9
0
9
0
9
1
9
7
7
4
32767
32768
131072
2147483647
1
./arith.tests: line 255: 2**-1 : exponent less than 0 (error token is "1 ")
4
4
5
5
4
3
3
4
4
7
./arith.tests: line 274: 7-- : arithmetic syntax error: operand expected (error token is "- ")
./arith.tests: line 276: --x=7 : attempted assignment to non-variable (error token is "=7 ")
./arith.tests: line 277: ++x=7 : attempted assignment to non-variable (error token is "=7 ")
./arith.tests: line 279: x++=7 : attempted assignment to non-variable (error token is "=7 ")
./arith.tests: line 280: x--=7 : attempted assignment to non-variable (error token is "=7 ")
4
7
-7
7
7
./arith.tests: line 292: --x++ : ++: assignment requires lvalue (error token is "++ ")
2
2
./arith1.sub: line 15: 4-- : arithmetic syntax error: operand expected (error token is "- ")
./arith1.sub: line 16: 4++ : arithmetic syntax error: operand expected (error token is "+ ")
./arith1.sub: line 17: 4 -- : arithmetic syntax error: operand expected (error token is "- ")
./arith1.sub: line 18: 4 ++ : arithmetic syntax error: operand expected (error token is "+ ")
1
2
1
2
6
3
7
4
0
3
7
2
-2
1
./arith1.sub: line 48: ((: ++ : arithmetic syntax error: operand expected (error token is "+ ")
7
7
./arith1.sub: line 51: ((: -- : arithmetic syntax error: operand expected (error token is "- ")
7
7
7
7
1
2
1
2
1
0
5
1
6
2
3
1
4
0
./arith2.sub: line 46: ((: -- : arithmetic syntax error: operand expected (error token is "- ")
-7
-7
./arith2.sub: line 50: ((: ++ : arithmetic syntax error: operand expected (error token is "+ ")
7
7
-7
-7
7
7
1
1
4
5
-3
2
4
5000
5000
1
0
0
1
2147483649
0
0
0
0
0
0
-9223372036854775808
-9223372036854775808
-9223372036854775808
-9223372036854775808
-9223372036854775808
-9223372036854775808
-9223372036854775808
-9223372036854775808
-9223372036854775808
-9223372036854775808
9223372036854775805 9223372036854775806 9223372036854775807
123 456
123 456
123 456
123 456
123 456
123 456
1
1 2 3 4 5 6 7
0 1 2 3 4 5 6 7
0
0, 0
0, 1
efg
e
efg
e
abcdefg
efg
0
0
0
0
0
0
0
./arith9.sub: line 4: a: unbound variable
./arith9.sub: line 5: a: unbound variable
0
after 3 0
0
after 4 0
./arith9.sub: line 14: b: expression recursion level exceeded (error token is "b")
+ var=42
+ echo 42
42
+ echo 0
0
+ echo 0
0
+ echo 0
0
+ ((  42  ))
+ echo 0
0
+ ((    ))
+ echo 1
1
+ set +x
./arith9.sub: line 37: 4+: arithmetic syntax error: operand expected (error token is "+")
x = 4+ y =
== arraysub ==
=== assoc_expand_once unset ===
declare -a a=([0]="10")
declare -a a=([0]="11")
declare -a a=([0]="12")
declare -a a=([0]="13")
declare -a a=([0]="14")
./arith10.sub: line 33: " ": arithmetic syntax error: operand expected (error token is "" "")
declare -a a=([0]="16")
declare -a a=([0]="17")
declare -a a=([0]="18")
./arith10.sub: line 38: "": arithmetic syntax error: operand expected (error token is """")
declare -a a=([0]="20")
declare -a a=([0]="21")
declare -a a=([0]="22")
declare -a a=([0]="23")
./arith10.sub: line 44: ((: `a[]': not a valid identifier
declare -a a=([0]="0")
./arith10.sub: line 45: `a[]': not a valid identifier
declare -a a=([0]="0")
declare -a a=([0]="26")
=== assoc_expand_once set ===
declare -a a=([0]="10")
declare -a a=([0]="11")
declare -a a=([0]="12")
declare -a a=([0]="13")
declare -a a=([0]="14")
./arith10.sub: line 33: " ": arithmetic syntax error: operand expected (error token is "" "")
declare -a a=([0]="16")
declare -a a=([0]="17")
./arith10.sub: line 36: " ": arithmetic syntax error: operand expected (error token is "" "")
./arith10.sub: line 38: "": arithmetic syntax error: operand expected (error token is """")
declare -a a=([0]="20")
declare -a a=([0]="21")
./arith10.sub: line 41: "": arithmetic syntax error: operand expected (error token is """")
declare -a a=([0]="23")
./arith10.sub: line 44: ((: `a[]': not a valid identifier
declare -a a=([0]="0")
./arith10.sub: line 45: `a[]': not a valid identifier
declare -a a=([0]="0")
./arith10.sub: line 46: "": arithmetic syntax error: operand expected (error token is """")
== substring ==
12
12


345
== cond ==
1
1
0
== arithsub ==
0
1 0
0
2 0
./arith10.sub: line 80: "" : arithmetic syntax error: operand expected (error token is """ ")
0
4 0
5 0
6 0
== arithcmd ==
1 1
2 1
3 1
./arith10.sub: line 89: ((: 1 -  : arithmetic syntax error: operand expected (error token is "-  ")
4 1
== letbltin ==
1 1
2 1
./arith10.sub: line 94: let: 0 - "": arithmetic syntax error: operand expected (error token is """")
3 1
./arith10.sub: line 95: let: 0 - "": arithmetic syntax error: operand expected (error token is """")
4 1
8 12
./arith.tests: line 335: ((: x=9 y=41 : arithmetic syntax error in expression (error token is "y=41 ")
./arith.tests: line 339: a b: arithmetic syntax error in expression (error token is "b")
./arith.tests: line 340: ((: a b: arithmetic syntax error in expression (error token is "b")
42
42
42
42
42
42
./arith.tests: line 355: 'foo' : arithmetic syntax error: operand expected (error token is "'foo' ")
./arith.tests: line 358: b[c]d: arithmetic syntax error in expression (error token is "d")