1 ## compare_shells: bash dash mksh
2 #### builtin.history.nonposix.test
3 cat > scr <<EOF
4 history | grep history >/dev/null || exit 1
5 echo hi >/dev/null
6 history | grep echo >/dev/null || exit 2
7 history -c
8 history >hist
9 grep echo >/dev/null hist && exit 3
10 set -o nolog
11 history -c
12 echo hello >/dev/null
13 history >hist2
14 grep echo >/dev/null hist2 && exit 4
15 echo ok
16 EOF
17 $TEST_SHELL -i scr 2>/dev/null
18 ## STDOUT:
19 ok
20 ## END
21
22 #### builtin.readonly.assign.interactive.test
23 cat >scr <<'EOF'
24 foo=bar
25 readonly -- foo
26 readonly -- baz=quux
27 echo $foo $baz >&3
28 foo=nope
29 unset baz
30 echo $foo $baz >&3
31 EOF
32 exec 3>&1 1>/dev/null 2>/dev/null
33 $TEST_SHELL -i scr
34 ## STDOUT:
35 bar quux
36 bar quux
37 ## END
38
39 #### parse.error.test
40 echo ')' >scr
41 $TEST_SHELL scr || echo sh ok
42 { echo eval ')' | $TEST_SHELL -i ; } || echo eval ok
43 $TEST_SHELL -c '. ./scr' || echo dot ok
44
45 ## STDOUT:
46 sh ok
47 eval ok
48 dot ok
49 ## END
50
51 #### semantics.interactive.expansion.exit.test
52 PS1="" $TEST_SHELL -i -c 'echo ${x?alas, poor yorick}; echo hello; exit'
53
54 ## STDOUT:
55 hello
56 ## END
57
58 #### sh.interactive.ps1.test
59 echo exit | PS1='$ ' $TEST_SHELL -i
60
61
62 #### sh.ps1.override.test
63 unset PS1
64 $TEST_SHELL -i <<EOF
65 echo hi
66 echo bye
67 EOF
68
69 PS1='PS1$ ' $TEST_SHELL -i <<EOF
70 echo hi
71 echo bye
72 EOF
73 ## STDOUT:
74 hi
75 bye
76 hi
77 bye
78 ## END
79