1 |
#
|
2 |
# Some nonsensical combinations which can all be detected at PARSE TIME.
|
3 |
# All shells allow these, but right now OSH disallowed.
|
4 |
# TODO: Run the parser on your whole corpus, and then if there are no errors,
|
5 |
# you should make OSH the OK behavior, and others are OK.
|
6 |
|
7 |
|
8 |
f() {
|
9 |
# NOTE: local treated like a special builtin!
|
10 |
E=env local v=var
|
11 |
echo $E $v
|
12 |
}
|
13 |
f
|
14 |
## status: 0
|
15 |
## stdout: env var
|
16 |
## OK bash stdout: var
|
17 |
|
18 |
|
19 |
f() {
|
20 |
# NOTE: local treated like a special builtin!
|
21 |
local E=env > _tmp/r.txt
|
22 |
}
|
23 |
rm -f _tmp/r.txt
|
24 |
f
|
25 |
test -f _tmp/r.txt && echo REDIRECTED
|
26 |
## status: 0
|
27 |
## stdout: REDIRECTED
|
28 |
|
29 |
|
30 |
for x in a b c; do
|
31 |
echo $x
|
32 |
E=env break
|
33 |
done
|
34 |
## status: 0
|
35 |
## stdout: a
|
36 |
## OK osh status: 2
|
37 |
## OK osh stdout-json: ""
|
38 |
|
39 |
|
40 |
rm -f _tmp/r.txt
|
41 |
for x in a b c; do
|
42 |
break > _tmp/r.txt
|
43 |
done
|
44 |
if test -f _tmp/r.txt; then
|
45 |
echo REDIRECTED
|
46 |
else
|
47 |
echo NO
|
48 |
fi
|
49 |
## status: 0
|
50 |
## stdout: REDIRECTED
|
51 |
## OK osh stdout: NO
|
52 |
|
53 |
|
54 |
shopt -s oil:all
|
55 |
rm -f _tmp/r.txt
|
56 |
for x in a b c; do
|
57 |
break > _tmp/r.txt
|
58 |
done
|
59 |
test -f _tmp/r.txt && echo REDIRECTED
|
60 |
## status: 0
|
61 |
## stdout: REDIRECTED
|
62 |
## OK osh status: 2
|
63 |
## OK osh stdout-json: ""
|