1
2 #### echo keyword
3 echo done
4 ## stdout: done
5
6 #### if/else
7 if false; then
8 echo THEN
9 else
10 echo ELSE
11 fi
12 ## stdout: ELSE
13
14 #### Turn an array into an integer.
15 a=(1 2 3)
16 (( a = 42 ))
17 echo $a
18 ## stdout: 42
19 ## N-I dash/ash stdout-json: ""
20 ## N-I dash/ash status: 2
21
22
23 #### assign readonly -- one line
24 readonly x=1; x=2; echo hi
25 ## status: 1
26 ## OK dash/mksh/ash status: 2
27 ## STDOUT:
28 ## END
29
30 #### assign readonly -- multiple lines
31 readonly x=1
32 x=2
33 echo hi
34 ## status: 1
35 ## OK dash/mksh/ash status: 2
36 ## STDOUT:
37 ## END
38 ## BUG bash status: 0
39 ## BUG bash STDOUT:
40 hi
41 ## END
42
43 #### assign readonly -- multiple lines -- set -o posix
44 set -o posix
45 readonly x=1
46 x=2
47 echo hi
48 ## status: 1
49 ## OK dash/mksh/ash status: 2
50 ## STDOUT:
51 ## END
52
53 #### unset readonly -- one line
54 readonly x=1; unset x; echo hi
55 ## STDOUT:
56 hi
57 ## END
58 ## OK dash/ash status: 2
59 ## OK zsh status: 1
60 ## OK dash/ash stdout-json: ""
61 ## OK zsh stdout-json: ""
62
63 #### unset readonly -- multiple lines
64 readonly x=1
65 unset x
66 echo hi
67 ## OK dash/ash status: 2
68 ## OK zsh status: 1
69 ## OK dash/ash stdout-json: ""
70 ## OK zsh stdout-json: ""
71
72 #### First word like foo$x() and foo$[1+2] (regression)
73
74 # Problem: $x() func call broke this error message
75 foo$identity('z')
76
77 foo$[1+2]
78
79 echo DONE
80
81 ## status: 2
82 ## OK mksh/zsh status: 1
83 ## STDOUT:
84 ## END
85 ## OK osh status: 0
86 ## OK osh STDOUT:
87 DONE
88 ## END
89
90 #### Function names
91 foo$x() {
92 echo hi
93 }
94
95 foo $x() {
96 echo hi
97 }
98
99 ## status: 2
100 ## OK mksh/zsh/osh status: 1
101 ## BUG zsh status: 0
102 ## STDOUT:
103 ## END