Results for sh-usage.test.sh

statusbashmkshkshtoyshsushbrushosh
pass 129978914
ok 0100000
N-I 1400000
FAIL 0057650
TIME 1000000
total14141414141414
casebashmkshkshtoyshsushbrushoshdescription
0pass pass pass pass pass pass pass sh -c
1pass pass pass pass pass pass pass empty -c input
2pass N-I FAIL FAIL FAIL FAIL pass sh +c is accepted
detailsdetailsdetailsdetailsdetails
3pass pass pass pass pass pass pass empty stdin
4pass N-I FAIL pass FAIL pass pass shell obeys --help (regression for OSH)
detailsdetailsdetails
5pass pass pass pass pass pass pass args are passed
6pass pass pass pass pass FAIL pass args that look like flags are passed after script
details
7pass pass pass FAIL pass FAIL pass args that look like flags are passed after -c
detailsdetails
8pass pass pass pass pass pass pass exit with explicit arg
9pass pass pass FAIL pass pass pass exit with no args
details
10TIME N-I FAIL FAIL FAIL FAIL pass --rcfile in non-interactive shell prints warnings
detailsdetailsdetailsdetailsdetailsdetails
11pass pass pass FAIL FAIL pass pass accepts -l flag
detailsdetails
12pass ok FAIL FAIL FAIL pass pass accepts --login flag (dash and mksh don't accept long flags)
detailsdetailsdetailsdetails
13N-I N-I FAIL FAIL FAIL FAIL pass osh --eval
detailsdetailsdetailsdetailsdetailsdetails
68 passed, 1 OK, 5 not implemented, 0 BUG, 23 failed, 1 timeouts, 0 cases skipped

Details on runs that didn't PASS

mksh2 sh +c is accepted

stdout:
stderr: 
mksh: echo hi: No such file or directory
ksh2 sh +c is accepted

[ksh stdout] Expected 'hi\n', got ''
[ksh status] Expected 0, got 127

stdout:
stderr: 
E: ksh: echo hi: No such file or directory
toysh2 sh +c is accepted

[toysh stdout] Expected 'hi\n', got ''
[toysh status] Expected 0, got 1

stdout:
stderr: 
sh: +c: No such file or directory
sush2 sh +c is accepted

[sush stdout] Expected 'hi\n', got ''
[sush status] Expected 0, got 2

stdout:
stderr: 
/home/andy/git/oils-for-unix/oils/../../shells/rusty_bash/target/release/sush: echo hi: No such file or directory
brush2 sh +c is accepted

[brush stdout] Expected 'hi\n', got ''
[brush status] Expected 0, got 1

stdout:
stderr: 
ERROR error: failed to source file: +c; i/o error: No such file or directory (os error 2)
mksh4 shell obeys --help (regression for OSH)

stdout:
stderr: 
mksh: mksh: --: unknown option
ksh4 shell obeys --help (regression for OSH)

[ksh stdout] Expected 'yes\n', got ''

stdout:
stderr: 
E: ksh: --: unknown option
sush4 shell obeys --help (regression for OSH)

[sush stdout] Expected 'yes\n', got ''

stdout:
stderr: 
: line : set: --: invalid option
brush6 args that look like flags are passed after script

[brush stdout] Expected "['--help', '--help', '-h']\n", got 'brush is a Rust-implemented, POSIX-style shell that aims to be compatible with bash.\n\nbrush is a work in progress. If you encounter any issues or discrepancies in behavior from bash,\nplease report them at https://github.com/reubeno/brush.\n\nUsage: brush [OPTIONS] [SCRIPT_PATH] [SCRIPT_ARGS]...\n\nArguments:\n [SCRIPT_PATH]\n Path to script to execute\n\n [SCRIPT_ARGS]...\n Arguments for script\n\nOptions:\n --help\n Display usage information\n\n --version\n Display shell version\n\n -C\n Enable noclobber shell option\n\n -c <COMMAND>\n Execute the provided command and then exit\n\n -i\n Run in interactive mode\n\n -l, --login\n Make shell act as if it had been invoked as a login shell\n\n -n\n Do not execute commands\n\n --noediting\n Don\'t use readline for input\n\n --noprofile\n Don\'t process any profile/login files (`/etc/profile`, `~/.bash_profile`, `~/.bash_login`,\n `~/.profile`)\n\n --norc\n Don\'t process "rc" files if the shell is interactive (e.g., `~/.bashrc`, `~/.brushrc`)\n\n --noenv\n Don\'t inherit environment variables from the calling process\n\n -O <OPTION>\n Enable shell option\n\n --posix\n Disable non-POSIX extensions\n\n -s\n Read commands from standard input\n\n --sh\n Run in sh compatibility mode\n\n -t\n Run only one command\n\n -v, --verbose\n Print input when it\'s processed\n\n -x\n Print commands as they execute\n\n --disable-bracketed-paste\n Disable bracketed paste\n\n --disable-color\n Disable colorized output\n\n --enable-highlighting\n Enable syntax highlighting (experimental)\n\n --input-backend <INPUT_BACKEND>\n Input backend\n\n Possible values:\n - reedline: Richest input backend, based on reedline\n - basic: Basic input backend that provides minimal completion support for testing\n - minimal: Most minimal input backend\n\n --debug <EVENT>\n Enable debug logging for classes of tracing events\n\n Possible values:\n - arithmetic: Traces parsing and evaluation of arithmetic expressions\n - commands: Traces command execution\n - complete: Traces command completion generation\n - expand: Traces word expansion\n - functions: Traces functions\n - input: Traces input controls\n - jobs: Traces job management\n - parse: Traces the process of parsing tokens into an abstract syntax tree\n - pattern: Traces pattern matching\n - tokenize: Traces the process of tokenizing input text\n - unimplemented: Traces usage of unimplemented functionality\n\n --disable-event <EVENT>\n Disable logging for classes of tracing events\n\n Possible values:\n - arithmetic: Traces parsing and evaluation of arithmetic expressions\n - commands: Traces command execution\n - complete: Traces command completion generation\n - expand: Traces word expansion\n - functions: Traces functions\n - input: Traces input controls\n - jobs: Traces job management\n - parse: Traces the process of parsing tokens into an abstract syntax tree\n - pattern: Traces pattern matching\n - tokenize: Traces the process of tokenizing input text\n - unimplemented: Traces usage of unimplemented functionality\n'

stdout:
brush is a Rust-implemented, POSIX-style shell that aims to be compatible with bash.

brush is a work in progress. If you encounter any issues or discrepancies in behavior from bash,
please report them at https://github.com/reubeno/brush.

Usage: brush [OPTIONS] [SCRIPT_PATH] [SCRIPT_ARGS]...

Arguments:
  [SCRIPT_PATH]
          Path to script to execute

  [SCRIPT_ARGS]...
          Arguments for script

Options:
      --help
          Display usage information

      --version
          Display shell version

  -C
          Enable noclobber shell option

  -c <COMMAND>
          Execute the provided command and then exit

  -i
          Run in interactive mode

  -l, --login
          Make shell act as if it had been invoked as a login shell

  -n
          Do not execute commands

      --noediting
          Don't use readline for input

      --noprofile
          Don't process any profile/login files (`/etc/profile`, `~/.bash_profile`, `~/.bash_login`,
          `~/.profile`)

      --norc
          Don't process "rc" files if the shell is interactive (e.g., `~/.bashrc`, `~/.brushrc`)

      --noenv
          Don't inherit environment variables from the calling process

  -O <OPTION>
          Enable shell option

      --posix
          Disable non-POSIX extensions

  -s
          Read commands from standard input

      --sh
          Run in sh compatibility mode

  -t
          Run only one command

  -v, --verbose
          Print input when it's processed

  -x
          Print commands as they execute

      --disable-bracketed-paste
          Disable bracketed paste

      --disable-color
          Disable colorized output

      --enable-highlighting
          Enable syntax highlighting (experimental)

      --input-backend <INPUT_BACKEND>
          Input backend

          Possible values:
          - reedline: Richest input backend, based on reedline
          - basic:    Basic input backend that provides minimal completion support for testing
          - minimal:  Most minimal input backend

      --debug <EVENT>
          Enable debug logging for classes of tracing events

          Possible values:
          - arithmetic:    Traces parsing and evaluation of arithmetic expressions
          - commands:      Traces command execution
          - complete:      Traces command completion generation
          - expand:        Traces word expansion
          - functions:     Traces functions
          - input:         Traces input controls
          - jobs:          Traces job management
          - parse:         Traces the process of parsing tokens into an abstract syntax tree
          - pattern:       Traces pattern matching
          - tokenize:      Traces the process of tokenizing input text
          - unimplemented: Traces usage of unimplemented functionality

      --disable-event <EVENT>
          Disable logging for classes of tracing events

          Possible values:
          - arithmetic:    Traces parsing and evaluation of arithmetic expressions
          - commands:      Traces command execution
          - complete:      Traces command completion generation
          - expand:        Traces word expansion
          - functions:     Traces functions
          - input:         Traces input controls
          - jobs:          Traces job management
          - parse:         Traces the process of parsing tokens into an abstract syntax tree
          - pattern:       Traces pattern matching
          - tokenize:      Traces the process of tokenizing input text
          - unimplemented: Traces usage of unimplemented functionality
stderr:
toysh7 args that look like flags are passed after -c

[toysh stdout] Expected "['--help', '-h']\n", got 'Toybox 0.8.12 multicall binary (see toybox --help)\n\nusage: sh [-c command] [script]\n\nCommand shell. Runs a shell script, or reads input interactively\nand responds to it. Roughly compatible with "bash". Run "help" for\nlist of built-in commands.\n\n-c\tcommand line to execute\n-i\tinteractive mode (default when STDIN is a tty)\n-s\tdon\'t run script (args set $* parameters but read commands from stdin)\n\nCommand shells parse each line of input (prompting when interactive), perform\nvariable expansion and redirection, execute commands (spawning child processes\nand background jobs), and perform flow control based on the return code.\n\nParsing:\n syntax errors\n\nInteractive prompts:\n line continuation\n\nVariable expansion:\n Note: can cause syntax errors at runtime\n\nRedirection:\n HERE documents (parsing)\n Pipelines (flow control and job control)\n\nRunning commands:\n process state\n builtins\n cd [[ ]] (( ))\n ! : [ # TODO: help for these?\n true false help echo kill printf pwd test\n child processes\n\nJob control:\n & Background process\n Ctrl-C kill process\n Ctrl-Z suspend process\n bg fg jobs kill\n\nFlow control:\n; End statement (same as newline)\n& Background process (returns true unless syntax error)\n&& If this fails, next command fails without running\n|| If this succeeds, next command succeeds without running\n| Pipelines! (Can of worms...)\nfor {name [in...]}|((;;)) do; BODY; done\nif TEST; then BODY; fi\nwhile TEST; do BODY; done\ncase a in X);; esac\n[[ TEST ]]\n((MATH))\n\nJob control:\n& Background process\nCtrl-C kill process\nCtrl-Z suspend process\nbg fg jobs kill\n'

stdout:
Toybox 0.8.12 multicall binary (see toybox --help)

usage: sh [-c command] [script]

Command shell.  Runs a shell script, or reads input interactively
and responds to it. Roughly compatible with "bash". Run "help" for
list of built-in commands.

-c	command line to execute
-i	interactive mode (default when STDIN is a tty)
-s	don't run script (args set $* parameters but read commands from stdin)

Command shells parse each line of input (prompting when interactive), perform
variable expansion and redirection, execute commands (spawning child processes
and background jobs), and perform flow control based on the return code.

Parsing:
  syntax errors

Interactive prompts:
  line continuation

Variable expansion:
  Note: can cause syntax errors at runtime

Redirection:
  HERE documents (parsing)
  Pipelines (flow control and job control)

Running commands:
  process state
  builtins
    cd [[ ]] (( ))
    ! : [ # TODO: help for these?
    true false help echo kill printf pwd test
  child processes

Job control:
  &    Background process
  Ctrl-C kill process
  Ctrl-Z suspend process
  bg fg jobs kill

Flow control:
;    End statement (same as newline)
&    Background process (returns true unless syntax error)
&&   If this fails, next command fails without running
||   If this succeeds, next command succeeds without running
|    Pipelines! (Can of worms...)
for {name [in...]}|((;;)) do; BODY; done
if TEST; then BODY; fi
while TEST; do BODY; done
case a in X);; esac
[[ TEST ]]
((MATH))

Job control:
&    Background process
Ctrl-C kill process
Ctrl-Z suspend process
bg fg jobs kill
stderr:
brush7 args that look like flags are passed after -c

[brush stdout] Expected "['--help', '-h']\n", got 'brush is a Rust-implemented, POSIX-style shell that aims to be compatible with bash.\n\nbrush is a work in progress. If you encounter any issues or discrepancies in behavior from bash,\nplease report them at https://github.com/reubeno/brush.\n\nUsage: brush [OPTIONS] [SCRIPT_PATH] [SCRIPT_ARGS]...\n\nArguments:\n [SCRIPT_PATH]\n Path to script to execute\n\n [SCRIPT_ARGS]...\n Arguments for script\n\nOptions:\n --help\n Display usage information\n\n --version\n Display shell version\n\n -C\n Enable noclobber shell option\n\n -c <COMMAND>\n Execute the provided command and then exit\n\n -i\n Run in interactive mode\n\n -l, --login\n Make shell act as if it had been invoked as a login shell\n\n -n\n Do not execute commands\n\n --noediting\n Don\'t use readline for input\n\n --noprofile\n Don\'t process any profile/login files (`/etc/profile`, `~/.bash_profile`, `~/.bash_login`,\n `~/.profile`)\n\n --norc\n Don\'t process "rc" files if the shell is interactive (e.g., `~/.bashrc`, `~/.brushrc`)\n\n --noenv\n Don\'t inherit environment variables from the calling process\n\n -O <OPTION>\n Enable shell option\n\n --posix\n Disable non-POSIX extensions\n\n -s\n Read commands from standard input\n\n --sh\n Run in sh compatibility mode\n\n -t\n Run only one command\n\n -v, --verbose\n Print input when it\'s processed\n\n -x\n Print commands as they execute\n\n --disable-bracketed-paste\n Disable bracketed paste\n\n --disable-color\n Disable colorized output\n\n --enable-highlighting\n Enable syntax highlighting (experimental)\n\n --input-backend <INPUT_BACKEND>\n Input backend\n\n Possible values:\n - reedline: Richest input backend, based on reedline\n - basic: Basic input backend that provides minimal completion support for testing\n - minimal: Most minimal input backend\n\n --debug <EVENT>\n Enable debug logging for classes of tracing events\n\n Possible values:\n - arithmetic: Traces parsing and evaluation of arithmetic expressions\n - commands: Traces command execution\n - complete: Traces command completion generation\n - expand: Traces word expansion\n - functions: Traces functions\n - input: Traces input controls\n - jobs: Traces job management\n - parse: Traces the process of parsing tokens into an abstract syntax tree\n - pattern: Traces pattern matching\n - tokenize: Traces the process of tokenizing input text\n - unimplemented: Traces usage of unimplemented functionality\n\n --disable-event <EVENT>\n Disable logging for classes of tracing events\n\n Possible values:\n - arithmetic: Traces parsing and evaluation of arithmetic expressions\n - commands: Traces command execution\n - complete: Traces command completion generation\n - expand: Traces word expansion\n - functions: Traces functions\n - input: Traces input controls\n - jobs: Traces job management\n - parse: Traces the process of parsing tokens into an abstract syntax tree\n - pattern: Traces pattern matching\n - tokenize: Traces the process of tokenizing input text\n - unimplemented: Traces usage of unimplemented functionality\n'

stdout:
brush is a Rust-implemented, POSIX-style shell that aims to be compatible with bash.

brush is a work in progress. If you encounter any issues or discrepancies in behavior from bash,
please report them at https://github.com/reubeno/brush.

Usage: brush [OPTIONS] [SCRIPT_PATH] [SCRIPT_ARGS]...

Arguments:
  [SCRIPT_PATH]
          Path to script to execute

  [SCRIPT_ARGS]...
          Arguments for script

Options:
      --help
          Display usage information

      --version
          Display shell version

  -C
          Enable noclobber shell option

  -c <COMMAND>
          Execute the provided command and then exit

  -i
          Run in interactive mode

  -l, --login
          Make shell act as if it had been invoked as a login shell

  -n
          Do not execute commands

      --noediting
          Don't use readline for input

      --noprofile
          Don't process any profile/login files (`/etc/profile`, `~/.bash_profile`, `~/.bash_login`,
          `~/.profile`)

      --norc
          Don't process "rc" files if the shell is interactive (e.g., `~/.bashrc`, `~/.brushrc`)

      --noenv
          Don't inherit environment variables from the calling process

  -O <OPTION>
          Enable shell option

      --posix
          Disable non-POSIX extensions

  -s
          Read commands from standard input

      --sh
          Run in sh compatibility mode

  -t
          Run only one command

  -v, --verbose
          Print input when it's processed

  -x
          Print commands as they execute

      --disable-bracketed-paste
          Disable bracketed paste

      --disable-color
          Disable colorized output

      --enable-highlighting
          Enable syntax highlighting (experimental)

      --input-backend <INPUT_BACKEND>
          Input backend

          Possible values:
          - reedline: Richest input backend, based on reedline
          - basic:    Basic input backend that provides minimal completion support for testing
          - minimal:  Most minimal input backend

      --debug <EVENT>
          Enable debug logging for classes of tracing events

          Possible values:
          - arithmetic:    Traces parsing and evaluation of arithmetic expressions
          - commands:      Traces command execution
          - complete:      Traces command completion generation
          - expand:        Traces word expansion
          - functions:     Traces functions
          - input:         Traces input controls
          - jobs:          Traces job management
          - parse:         Traces the process of parsing tokens into an abstract syntax tree
          - pattern:       Traces pattern matching
          - tokenize:      Traces the process of tokenizing input text
          - unimplemented: Traces usage of unimplemented functionality

      --disable-event <EVENT>
          Disable logging for classes of tracing events

          Possible values:
          - arithmetic:    Traces parsing and evaluation of arithmetic expressions
          - commands:      Traces command execution
          - complete:      Traces command completion generation
          - expand:        Traces word expansion
          - functions:     Traces functions
          - input:         Traces input controls
          - jobs:          Traces job management
          - parse:         Traces the process of parsing tokens into an abstract syntax tree
          - pattern:       Traces pattern matching
          - tokenize:      Traces the process of tokenizing input text
          - unimplemented: Traces usage of unimplemented functionality
stderr:
toysh9 exit with no args

[toysh status] Expected 1, got 0

stdout:
stderr: 
mksh10 --rcfile in non-interactive shell prints warnings

stdout:
==> interactive.txt <==
mksh: mksh: --: unknown option

==> non-interactive.txt <==
mksh: mksh: --: unknown option
stderr:
warned=1
warned=1
ksh10 --rcfile in non-interactive shell prints warnings

[ksh stderr] Expected 'warned=1\nwarned=0\n', got 'warned=1\nwarned=1\n'

stdout:
==> interactive.txt <==
E: ksh: --: unknown option

==> non-interactive.txt <==
E: ksh: --: unknown option
stderr:
warned=1
warned=1
toysh10 --rcfile in non-interactive shell prints warnings

[toysh stderr] Expected 'warned=1\nwarned=0\n', got 'warned=1\nwarned=1\n'

stdout:
==> interactive.txt <==
sh: Unknown option 'rcfile' (see "sh --help")

==> non-interactive.txt <==
sh: Unknown option 'rcfile' (see "sh --help")
stderr:
warned=1
warned=1
sush10 --rcfile in non-interactive shell prints warnings

[sush stderr] Expected 'warned=1\nwarned=0\n', got 'warned=1\nwarned=1\n'

stdout:
==> interactive.txt <==
: line : set: --: invalid option

==> non-interactive.txt <==
: line : set: --: invalid option
stderr:
warned=1
warned=1
brush10 --rcfile in non-interactive shell prints warnings

[brush stderr] Expected 'warned=1\nwarned=0\n', got 'warned=1\nwarned=1\n'

stdout:
==> interactive.txt <==
ERROR error: failed to source file: --rcfile; i/o error: No such file or directory (os error 2)

==> non-interactive.txt <==
ERROR error: failed to source file: --rcfile; i/o error: No such file or directory (os error 2)
stderr:
warned=1
warned=1
toysh11 accepts -l flag

[toysh status] Expected 0, got 1

stdout:
stderr: 
sh: Unknown option 'l' (see "sh --help")
sush11 accepts -l flag

[sush status] Expected 0, got 2

stdout:
stderr: 
: line : set: -l: invalid option
mksh12 accepts --login flag (dash and mksh don't accept long flags)

stdout:
stderr: 
mksh: mksh: --: unknown option
ksh12 accepts --login flag (dash and mksh don't accept long flags)

[ksh status] Expected 0, got 1

stdout:
stderr: 
E: ksh: --: unknown option
toysh12 accepts --login flag (dash and mksh don't accept long flags)

[toysh status] Expected 0, got 1

stdout:
stderr: 
sh: Unknown option 'login' (see "sh --help")
sush12 accepts --login flag (dash and mksh don't accept long flags)

[sush status] Expected 0, got 2

stdout:
stderr: 
: line : -g: invalid option name
bash13 osh --eval

stdout:
stderr: 
mksh13 osh --eval

stdout:
stderr: 
ksh13 osh --eval

[ksh stdout] Expected 'one x y z\nstatus=0 flag -c x y z\n\none x y z\nfail x y z\nstatus=42 flag -c x y z\nstatus=0\n' Got '\nstatus=1\n'

stdout:
status=1
stderr:
E: ksh: --: unknown option
E: ksh: --: unknown option
toysh13 osh --eval

[toysh stdout] Expected 'one x y z\nstatus=0 flag -c x y z\n\none x y z\nfail x y z\nstatus=42 flag -c x y z\nstatus=0\n' Got ''
[toysh status] Expected 0, got -6

stdout:
stderr: 
munmap_chunk(): invalid pointer
sush13 osh --eval

[sush stdout] Expected 'one x y z\nstatus=0 flag -c x y z\n\none x y z\nfail x y z\nstatus=42 flag -c x y z\nstatus=0\n' Got '\nstatus=2\n'

stdout:
status=2
stderr:
: line : set: --: invalid option
: line : set: --: invalid option
brush13 osh --eval

[brush stdout] Expected 'one x y z\nstatus=0 flag -c x y z\n\none x y z\nfail x y z\nstatus=42 flag -c x y z\nstatus=0\n' Got '\nstatus=127\n'

stdout:
status=127
stderr:
ERROR error: failed to source file: --eval; i/o error: No such file or directory (os error 2)
-c: command not found
ERROR error: failed to source file: --eval; i/o error: No such file or directory (os error 2)
-c: command not found