bash
|
0
$- with -c
stdout:
stderr:
|
mksh
|
0
$- with -c
stdout:
stderr:
|
bash
|
1
$- with pipefail
stdout:
stderr:
|
dash
|
1
$- with pipefail
stdout:
stderr:
dash: 1: set: Illegal option -o pipefail
|
mksh
|
1
$- with pipefail
stdout:
stderr:
|
dash
|
2
$- and more options
stdout:
stderr:
dash: 3: [[: not found
|
dash
|
6
pass shopt options like sh -O nullglob
stdout:
stderr:
dash: 0: Illegal option -O
dash: 0: Illegal option -O
|
mksh
|
6
pass shopt options like sh -O nullglob
stdout:
stderr:
mksh: mksh: -O: unknown option
mksh: mksh: -O: unknown option
|
dash
|
7
can continue after unknown option
stdout:
stderr:
dash: 2: set: Illegal option -o STRICT
|
mksh
|
7
can continue after unknown option
stdout:
stderr:
mksh: <stdin>[2]: set: STRICT: bad option
|
dash
|
10
vi and emacs are mutually exclusive
stdout:
stderr:
dash: 2: shopt: not found
dash: 2: shopt: not found
dash: 2: shopt: not found
|
mksh
|
10
vi and emacs are mutually exclusive
stdout:
stderr:
mksh: <stdin>[5]: shopt: not found
mksh: <stdin>[8]: shopt: not found
mksh: <stdin>[11]: shopt: not found
|
dash
|
11
interactive shell starts with emacs mode on
stdout:
stderr:
|
mksh
|
11
interactive shell starts with emacs mode on
stdout:
non-interactive
interactive
stderr:
|
dash
|
12
nounset
stdout:
stderr:
dash: 3: unset: parameter not set
|
dash
|
13
-u is nounset
stdout:
stderr:
dash: 3: unset: parameter not set
|
dash
|
19
set -eu (flag parsing)
stdout:
stderr:
dash: 2: unset: parameter not set
|
osh
|
20
-n for no execution (useful with --ast-output)
[osh stdout] Expected '1\n', got '1\n2\n3\n'
stdout:
stderr:
|
osh_ALT
|
20
-n for no execution (useful with --ast-output)
[osh_ALT stdout] Expected '1\n', got '1\n2\n3\n'
stdout:
stderr:
|
dash
|
21
pipefail
stdout:
stderr:
dash: 3: set: Illegal option -o pipefail
|
dash
|
22
shopt -p -o prints 'set' options
stdout:
stderr:
dash: 1: shopt: not found
dash: 3: shopt: not found
|
mksh
|
22
shopt -p -o prints 'set' options
stdout:
stderr:
mksh: <stdin>[1]: shopt: not found
mksh: <stdin>[3]: shopt: not found
|
dash
|
23
shopt -p prints 'shopt' options
stdout:
stderr:
dash: 1: shopt: not found
dash: 2: shopt: not found
dash: 3: shopt: not found
|
mksh
|
23
shopt -p prints 'shopt' options
stdout:
stderr:
mksh: <stdin>[1]: shopt: not found
mksh: <stdin>[2]: shopt: not found
mksh: <stdin>[3]: shopt: not found
|
dash
|
24
shopt with no flags prints options
stdout:
0 one.txt
stderr:
dash: 3: shopt: not found
dash: 8: shopt: not found
|
mksh
|
24
shopt with no flags prints options
stdout:
0 one.txt
stderr:
mksh: <stdin>[3]: shopt: not found
mksh: <stdin>[8]: shopt: not found
|
dash
|
26
noclobber on
stdout:
stderr:
dash: 5: cannot create /home/andy/git/oilshell/oil/_tmp/spec-tmp/sh-options.test.sh/26-dash/no-clobber: File exists
|
osh
|
26
noclobber on
[osh stdout] Expected u'0\n1\n', got '0\n0\n'
stdout:
stderr:
|
osh_ALT
|
26
noclobber on
[osh_ALT stdout] Expected u'0\n1\n', got '0\n0\n'
stdout:
stderr:
rm: cannot remove '/home/andy/git/oilshell/oil/_tmp/spec-tmp/sh-options.test.sh/26-osh_ALT/no-clobber': No such file or directory
|
dash
|
27
SHELLOPTS is updated when options are changed
stdout:
stderr:
+ grep -q xtrace
+ echo
+ echo 1
+ set +x
|
mksh
|
27
SHELLOPTS is updated when options are changed
stdout:
stderr:
+ echo
+ grep -q xtrace
+ echo 1
+ set +x
|
dash
|
28
SHELLOPTS is readonly
stdout:
status=0
stderr:
|
mksh
|
28
SHELLOPTS is readonly
stdout:
status=0
stderr:
|
osh
|
28
SHELLOPTS is readonly
stdout:
stderr:
SHELLOPTS=x
^~~~~~~~~~
[ stdin ]:1: fatal: Can't assign to readonly value 'SHELLOPTS'
|
osh_ALT
|
28
SHELLOPTS is readonly
stdout:
stderr:
SHELLOPTS=x
^~~~~~~~~~
[ stdin ]:1: fatal: Can't assign to readonly value 'SHELLOPTS'
|
mksh
|
29
set - -
stdout:
stderr:
|
osh
|
29
set - -
stdout:
- a b
stderr:
|
osh_ALT
|
29
set - -
stdout:
- a b
stderr:
|
dash
|
31
set without args lists variables
stdout:
__GLOBAL='mutated'
__OTHERLOCAL='L'
__mylocal='L'
__var_in_parent_scope='D'
stderr:
|
mksh
|
31
set without args lists variables
stdout:
__GLOBAL=mutated
__var_in_parent_scope=D
__OTHERLOCAL=L
__mylocal=L
stderr:
|
dash
|
33
set without args and array variables (not in OSH)
stdout:
stderr:
dash: 1: declare: not found
dash: 2: Syntax error: "(" unexpected
|
mksh
|
33
set without args and array variables (not in OSH)
stdout:
__array[0]=1
__array[1]=2
__array[2]='3 4'
stderr:
mksh: <stdin>[1]: declare: not found
|
osh
|
33
set without args and array variables (not in OSH)
stdout:
stderr:
|
osh_ALT
|
33
set without args and array variables (not in OSH)
stdout:
stderr:
|
dash
|
34
set without args and assoc array variables (not in OSH)
stdout:
stderr:
dash: 1: typeset: not found
dash: 2: __assoc[k e y]=v a l: not found
dash: 3: __assoc[a]=b: not found
|
mksh
|
34
set without args and assoc array variables (not in OSH)
stdout:
stderr:
mksh: <stdin>[1]: typeset: -A: unknown option
mksh: <stdin>[2]: 'k e y': multi-character character constant
|
osh
|
34
set without args and assoc array variables (not in OSH)
stdout:
stderr:
__assoc[a]=b
^~~~~~~~
[ stdin ]:3: fatal: Associative array keys must be strings: $x 'x' "$x" etc.
|
osh_ALT
|
34
set without args and assoc array variables (not in OSH)
stdout:
stderr:
__assoc[a]=b
^~~~~~~~
[ stdin ]:3: fatal: Associative array keys must be strings: $x 'x' "$x" etc.
|
dash
|
35
shopt -q
stdout:
nullglob=127
nullglob=127
nullglob,failglob=127
nullglob,failglob=127
stderr:
dash: 1: shopt: not found
dash: 4: shopt: not found
dash: 6: shopt: not found
dash: 9: shopt: not found
dash: 12: shopt: not found
dash: 13: shopt: not found
|
mksh
|
35
shopt -q
stdout:
nullglob=127
nullglob=127
nullglob,failglob=127
nullglob,failglob=127
stderr:
mksh: <stdin>[1]: shopt: not found
mksh: <stdin>[4]: shopt: not found
mksh: <stdin>[6]: shopt: not found
mksh: <stdin>[9]: shopt: not found
mksh: <stdin>[12]: shopt: not found
mksh: <stdin>[13]: shopt: not found
|
bash
|
36
shopt -q invalid
stdout:
invalidZZ=1
stderr:
bash: line 1: shopt: invalidZZ: invalid shell option name
|
dash
|
36
shopt -q invalid
stdout:
invalidZZ=127
stderr:
dash: 1: shopt: not found
|
mksh
|
36
shopt -q invalid
stdout:
invalidZZ=127
stderr:
mksh: <stdin>[1]: shopt: not found
|
bash
|
37
shopt -s strict:all
stdout:
stderr:
bash: line 9: shopt: strict:all: invalid shell option name
bash: line 11: shopt: strict_arith: invalid shell option name
|
dash
|
37
shopt -s strict:all
stdout:
stderr:
dash: 3: Syntax error: Bad function name
|
mksh
|
37
shopt -s strict:all
stdout:
stderr:
mksh: <stdin>[8]: shopt: not found
mksh: <stdin>[9]: shopt: not found
mksh: <stdin>[10]: shopt: not found
mksh: <stdin>[11]: shopt: not found
mksh: <stdin>[12]: shopt: not found
|
dash
|
38
shopt allows for backward compatibility like bash
stdout:
status=0
stderr:
dash: 3: shopt: not found
dash: 8: shopt: not found
|
mksh
|
38
shopt allows for backward compatibility like bash
stdout:
status=0
stderr:
mksh: <stdin>[3]: shopt: not found
mksh: <stdin>[8]: shopt: not found
|
bash
|
39
shopt -p validates option names
stdout:
shopt -u nullglob
shopt -u failglob
status=1
nullglob off
failglob off
status=1
stderr:
bash: line 1: shopt: invalid: invalid shell option name
bash: line 3: shopt: invalid: invalid shell option name
|
dash
|
39
shopt -p validates option names
stdout:
status=127
status=127
stderr:
dash: 1: shopt: not found
dash: 3: shopt: not found
|
mksh
|
39
shopt -p validates option names
stdout:
status=127
status=127
stderr:
mksh: <stdin>[1]: shopt: not found
mksh: <stdin>[3]: shopt: not found
|
bash
|
40
shopt -p -o validates option names
stdout:
set +o errexit
set +o nounset
status=1
stderr:
bash: line 1: shopt: invalid: invalid option name
|
dash
|
40
shopt -p -o validates option names
stdout:
status=127
stderr:
dash: 1: shopt: not found
|
mksh
|
40
shopt -p -o validates option names
stdout:
status=127
stderr:
mksh: <stdin>[1]: shopt: not found
|
bash
|
41
stubbed out bash options
stdout:
stderr:
bash: line 2: shopt: foo: invalid shell option name
|
dash
|
41
stubbed out bash options
stdout:
stderr:
dash: 2: shopt: not found
dash: 2: shopt: not found
dash: 2: shopt: not found
dash: 2: shopt: not found
|
mksh
|
41
stubbed out bash options
stdout:
stderr:
mksh: <stdin>[4]: shopt: not found
mksh: <stdin>[4]: shopt: not found
mksh: <stdin>[4]: shopt: not found
mksh: <stdin>[4]: shopt: not found
|
bash
|
42
shopt -s nounset works in Oil, not in bash
stdout:
status=1
nounset off
stderr:
bash: line 7: shopt: nounset: invalid shell option name
|
dash
|
42
shopt -s nounset works in Oil, not in bash
stdout:
stderr:
|
mksh
|
42
shopt -s nounset works in Oil, not in bash
stdout:
stderr:
|