1 |
|
2 |
|
3 |
echo $%
|
4 |
## stdout: $%
|
5 |
|
6 |
|
7 |
echo ${%}
|
8 |
## status: 2
|
9 |
## OK bash/mksh status: 1
|
10 |
|
11 |
|
12 |
if test -f /; then
|
13 |
echo ${%}
|
14 |
else
|
15 |
echo ok
|
16 |
fi
|
17 |
## status: 2
|
18 |
## BUG dash/bash/mksh status: 0
|
19 |
|
20 |
|
21 |
echo hi; while
|
22 |
echo status=$?
|
23 |
## status: 2
|
24 |
## stdout-json: ""
|
25 |
## OK mksh status: 1
|
26 |
|
27 |
|
28 |
echo hi; for
|
29 |
echo status=$?
|
30 |
## status: 2
|
31 |
## stdout-json: ""
|
32 |
## OK mksh status: 1
|
33 |
|
34 |
|
35 |
echo hi; if
|
36 |
echo status=$?
|
37 |
## status: 2
|
38 |
## stdout-json: ""
|
39 |
## OK mksh status: 1
|
40 |
|
41 |
|
42 |
do echo hi
|
43 |
## status: 2
|
44 |
## stdout-json: ""
|
45 |
## OK mksh status: 1
|
46 |
|
47 |
|
48 |
}
|
49 |
echo should not get here
|
50 |
## stdout-json: ""
|
51 |
## status: 2
|
52 |
## OK mksh status: 1
|
53 |
|
54 |
|
55 |
# bash and mksh give parse time error because of }
|
56 |
# dash gives 127 as runtime error
|
57 |
{ls; }
|
58 |
echo "status=$?"
|
59 |
## stdout-json: ""
|
60 |
## status: 2
|
61 |
## OK mksh status: 1
|
62 |
|
63 |
|
64 |
set -o errexit
|
65 |
{ls;
|
66 |
}
|
67 |
## status: 127
|
68 |
|
69 |
|
70 |
for i.j in a b c; do
|
71 |
echo hi
|
72 |
done
|
73 |
echo done
|
74 |
## stdout-json: ""
|
75 |
## status: 2
|
76 |
## OK mksh status: 1
|
77 |
## OK bash status: 0
|
78 |
## BUG bash stdout: done
|
79 |
|
80 |
|
81 |
# bash and dash disagree on exit code.
|
82 |
FOO-BAR=foo
|
83 |
## status: 127
|
84 |
|
85 |
|
86 |
# bash and dash disagree on exit code.
|
87 |
export FOO-BAR=foo
|
88 |
## status: 1
|
89 |
## OK dash status: 2
|
90 |
|
91 |
|
92 |
# bash and dash disagree on exit code.
|
93 |
f() {
|
94 |
local FOO-BAR=foo
|
95 |
}
|
96 |
f
|
97 |
## status: 1
|
98 |
## OK dash status: 2
|
99 |
|
100 |
|
101 |
echo a(b)
|
102 |
## status: 2
|
103 |
## OK mksh status: 1
|
104 |
|
105 |
|
106 |
$(x
|
107 |
## status: 2
|
108 |
## OK mksh status: 1
|
109 |
|
110 |
|
111 |
`x
|
112 |
## status: 2
|
113 |
## OK mksh status: 1
|
114 |
|
115 |
|
116 |
echo 1 ;; echo 2
|
117 |
## stdout-json: ""
|
118 |
## status: 2
|
119 |
## OK mksh status: 1
|
120 |
|
121 |
|
122 |
# regression test for commit 451ca9e2b437e0326fc8155783d970a6f32729d8
|
123 |
[[ || true ]]
|
124 |
## status: 2
|
125 |
## N-I dash status: 0
|
126 |
## OK mksh status: 1
|
127 |
|
128 |
|
129 |
flags=''
|
130 |
case $SH in
|
131 |
*bash|*osh)
|
132 |
flags='--rcfile /dev/null'
|
133 |
;;
|
134 |
esac
|
135 |
$SH $flags -i -c 'var=)'
|
136 |
|
137 |
## status: 2
|
138 |
## OK bash/mksh status: 1
|
139 |
|
140 |
|
141 |
a=( inside=() )
|
142 |
echo len=${#a[@]}
|
143 |
## status: 2
|
144 |
## stdout-json: ""
|
145 |
## OK mksh status: 1
|
146 |
## BUG bash status: 0
|
147 |
## BUG bash stdout: len=0
|
148 |
|
149 |
|
150 |
f() {
|
151 |
for x in a=(); do
|
152 |
echo $x
|
153 |
done
|
154 |
echo done
|
155 |
}
|
156 |
## status: 2
|
157 |
## stdout-json: ""
|
158 |
## OK mksh status: 1
|
159 |
|
160 |
|
161 |
f() {
|
162 |
case a=() in
|
163 |
foo)
|
164 |
echo hi
|
165 |
;;
|
166 |
esac
|
167 |
}
|
168 |
## status: 2
|
169 |
## stdout-json: ""
|
170 |
## OK mksh status: 1
|
171 |
|
172 |
|
173 |
|
174 |
# Lit_VarLike and then (, but NOT at the beginning of a word.
|
175 |
|
176 |
f() {
|
177 |
%foo=()
|
178 |
}
|
179 |
## status: 2
|
180 |
## stdout-json: ""
|
181 |
## OK mksh status: 1
|
182 |
|
183 |
|
184 |
=word
|
185 |
## OK osh status: 2
|
186 |
## status: 127
|
187 |
|
188 |
|
189 |
echo =word
|
190 |
## STDOUT:
|
191 |
=word
|
192 |
## END
|