Fedora 20 x86_64: /bin/sh = bash 4.2.47
Modern linux distribution where the listed shells installed from rpm packages, except The Heirloom Bourne Shell run from compiled binary.
Shells: /bin/sh, /bin/ksh, /bin/bash, /bin/zsh, /bin/dash, /bin/mksh, /bin/lksh, /sbin/busybox sh, heirloom/sh
01_test_command | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | |
02_test_command_v | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | |
03_test_cmdv_fail | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | heirloom sh |
04_test_builtin | sh | ksh | bash | zsh | mksh | lksh | |||
05_test_local | sh | bash | zsh | dash | mksh | lksh | busybox sh | ||
06_test_typeset | sh | bash | zsh | mksh | lksh | ||||
07_test_global | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | heirloom sh |
08_test_function | sh | ksh | bash | zsh | mksh | lksh | |||
09_test_function2 | sh | bash | zsh | mksh | lksh | ||||
10_test_exclmark | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | |
11_test_test | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | heirloom sh |
12_test_test_e | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | |
13_test_test_ef | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | |
14_test_test_nt | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | |
15_test_testexcl | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | heirloom sh |
16_test_testeqeq | sh | ksh | bash | zsh | mksh | lksh | busybox sh | ||
17_test_testtest | sh | ksh | bash | zsh | mksh | lksh | busybox sh | ||
18_test_tildexp | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | |
19_test_pwdvar | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | |
20_test_pwdcmd | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | heirloom sh |
21_test_true | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | |
22_test_colon | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | heirloom sh |
23_test_export1 | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | |
24_test_readonly2 | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | heirloom sh |
25_test_case_pxcl | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | heirloom sh |
26_test_case_pxcf | sh | ksh | bash | zsh | busybox sh | ||||
27_test_at0 | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | |
28_test_at1 | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | heirloom sh |
29_test_at0for | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | |
30_test_echoE | sh | bash | zsh | dash | mksh | lksh | heirloom sh | ||
31_test_echoc | sh | bash | zsh | dash | heirloom sh | ||||
32_test_echon | ksh | bash | zsh | dash | mksh | lksh | busybox sh | ||
33_test_bi_printf | sh | ksh | bash | zsh | dash | busybox sh | |||
34_test_dollar_sg | sh | ksh | bash | zsh | mksh | lksh | busybox sh | ||
35_test_hash_fatl | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | |
36_test_hash_btin | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | heirloom sh |
37_test_hash_fail | sh | bash | zsh | dash | busybox sh | heirloom sh | |||
38_test_iexpr | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | |
39_test_tfft | sh | ksh | bash | zsh | dash | mksh | lksh | busybox sh | heirloom sh |
40_test_icat | sh | ksh | bash | zsh | mksh | lksh |
set -eu #set -x PATH=; export PATH case ${BASH_VERSION-} in *.*) # Make echo builtin in bash expands backslash-escape sequences by # default. Without this bash would be less portable compared to # most other shells... shopt -s xpg_echo # make sure pipefail is not set (bash-only feature)... set +o pipefail #list_functions () { set; } esac case ${ZSH_VERSION-} in *.*) setopt shwordsplit setopt posix_builtins # for test_command() unsetopt equals # for [ 1 == 1 ] (nonstandard usage...) unsetopt bsd_echo # enable echo escape sequences (like \c) #setopt equals # make [ 1 == 1 ] fail for sure... unsetopt function_argzero # $0 being the name of this script always #list_functions () { functions; } esac withpath () { PATH=/bin:/usr/bin; export PATH; "$@"; PATH=; export PATH; } saved_IFS=$IFS; readonly saved_IFS set -x
#!/bin/sh test_command () # builtin or system, not function or alias { # one could argue whether command should include builtins... alias echo='exit 1' || : echo () { exit 1; } command echo } . portabilitytest/common.sh test_command
+ test_command + alias echo=exit 1 portabilitytest/01_test_command: alias: not found + : + command echo portabilitytest/01_test_command: command: not found
1 of the tested shells failed to execute this test
#!/bin/sh test_command_v () # the -v option { # first check that there is builtin 'command' command echo || exit 1 # expect cat reside in /bin, to make this run not fail PATH=/bin; export PATH case `command -v cat` in *cat) ;; *) exit 1; esac } . portabilitytest/common.sh test_command_v
+ test_command_v + command echo portabilitytest/02_test_command_v: command: not found + exit 1
1 of the tested shells failed to execute this test
#!/bin/sh test_cmdv_fail () # if command -v fails in case command not found { if command -v this_c0mmand_does_not_existt then exit 1 else exit 0 fi } . portabilitytest/common.sh test_cmdv_fail
all of the tested shells executed this test successfully
#!/bin/sh test_builtin () # builtin command { echo () { return 1; } builtin echo } . portabilitytest/common.sh test_builtin
+ test_builtin + builtin echo portabilitytest/04_test_builtin: 5: portabilitytest/04_test_builtin: builtin: not found
+ test_builtin + builtin echo portabilitytest/04_test_builtin: line 1: builtin: not found
+ test_builtin + builtin echo portabilitytest/04_test_builtin: builtin: not found
3 of the tested shells failed to execute this test
#!/bin/sh test_local () # local variable { lt () { local var=ilval case $var in ilval) ;; *) exit 1 ;; esac } local var=lval lt case $var in lval) ;; *) exit 1 ;; esac } . portabilitytest/common.sh test_local
+ test_local + local var=lval portabilitytest/05_test_local[8]: local: not found [No such file or directory]
+ test_local + local var=lval portabilitytest/05_test_local: local: not found
2 of the tested shells failed to execute this test
#!/bin/sh test_typeset () # local variable using plain typeset (typeset/declare without opts) { # declare: same as typeset (in bash, zsh, ...) but less portable lt () { typeset var=ilval case $var in ilval) ;; *) exit 1 ;; esac } typeset var=lval lt case $var in lval) ;; *) exit 1 ;; esac } . portabilitytest/common.sh test_typeset
+ test_typeset + var=lval + typeset var + lt + var=ilval + typeset var + exit 1
+ test_typeset + typeset var=lval portabilitytest/06_test_typeset: 9: portabilitytest/06_test_typeset: typeset: not found
+ test_typeset + typeset var=lval portabilitytest/06_test_typeset: line 1: typeset: not found
+ test_typeset + typeset var=lval portabilitytest/06_test_typeset: typeset: not found
4 of the tested shells failed to execute this test
#!/bin/sh test_global () # test whether variable is global always { gt () { var=local } var=global gt case $var in local) exit 0 ;; *) exit 1 ;; esac } . portabilitytest/common.sh test_global
all of the tested shells executed this test successfully
#!/bin/sh test_function () # function keyword { function inner { :; } inner } . portabilitytest/common.sh test_function
portabilitytest/08_test_function: 5: portabilitytest/08_test_function: inner: not found portabilitytest/08_test_function: 6: portabilitytest/08_test_function: Syntax error: "}" unexpected
portabilitytest/08_test_function: line 5: inner: not found portabilitytest/08_test_function: line 6: syntax error: unexpected "}"
portabilitytest/08_test_function: inner: not found portabilitytest/08_test_function: syntax error at line 6: `}' unexpected
3 of the tested shells failed to execute this test
#!/bin/sh test_function2 () # function keyword, with () { function inner () { :; } inner } . portabilitytest/common.sh test_function2
portabilitytest/09_test_function2: syntax error at line 4: `(' unexpected
portabilitytest/09_test_function2: 4: portabilitytest/09_test_function2: Syntax error: "(" unexpected (expecting "}")
portabilitytest/09_test_function2: line 4: syntax error: unexpected "(" (expecting "}")
portabilitytest/09_test_function2: syntax error at line 4: `(' unexpected
4 of the tested shells failed to execute this test
#!/bin/sh test_exclmark () # whether '!' as 'not' works (and is builtin) { # fails in heirloom sh ! /bin/false } . portabilitytest/common.sh test_exclmark
+ test_exclmark + ! /bin/false portabilitytest/10_test_exclmark: !: not found
1 of the tested shells failed to execute this test
#!/bin/sh test_test () # builtin test command { test string } . portabilitytest/common.sh test_test
all of the tested shells executed this test successfully
#!/bin/sh test_test_e () # test -e file (well, current directory) { if test -e "$0"; then exit 0; else exit 1; fi } . portabilitytest/common.sh test_test_e
+ test_test_e + test -e portabilitytest/12_test_test_e portabilitytest/12_test_test_e: test: argument expected
1 of the tested shells failed to execute this test
#!/bin/sh test_test_ef () # test file1 -ef file2 { td=`withpath mktemp -d /tmp/tmp.XXXXXX`; ev=1 trap '/bin/rm -rf $td; exit $ev' 0 : > $td/file1 /bin/ln $td/file1 $td/file2 if test $td/file1 -ef $td/file2; then ev=0; fi } . portabilitytest/common.sh test_test_ef
+ test_test_ef + withpath mktemp -d /tmp/tmp.XXXXXX PATH=/bin:/usr/bin + export PATH + mktemp -d /tmp/tmp.XXXXXX PATH= + export PATH td=/tmp/tmp.hdTNqs ev=1 + trap /bin/rm -rf $td; exit $ev 0 + : + /bin/ln /tmp/tmp.hdTNqs/file1 /tmp/tmp.hdTNqs/file2 + test /tmp/tmp.hdTNqs/file1 -ef /tmp/tmp.hdTNqs/file2 portabilitytest/13_test_test_ef: test: unknown operator -ef + /bin/rm -rf /tmp/tmp.hdTNqs + exit 1
1 of the tested shells failed to execute this test
#!/bin/sh test_test_nt () # test file1 -nt file2 (presumed -ot is also supported if -nt is) { td=`withpath mktemp -d /tmp/tmp.XXXXXX`; ev=1 #trap '/bin/rm -rf $td; exit $ev' 0 # XXX expects system time & fs times to work as usual : > $td/newfile if test $td/newfile -nt "$0"; then ev=0; fi } . portabilitytest/common.sh test_test_nt
+ test_test_nt + withpath mktemp -d /tmp/tmp.XXXXXX PATH=/bin:/usr/bin + export PATH + mktemp -d /tmp/tmp.XXXXXX PATH= + export PATH td=/tmp/tmp.SV5p15 ev=1 + : + test /tmp/tmp.SV5p15/newfile -nt portabilitytest/14_test_test_nt portabilitytest/14_test_test_nt: test: unknown operator -nt
1 of the tested shells failed to execute this test
#!/bin/sh test_testexcl () # '!' in test { if test '!' string; then exit 1; else exit 0; fi } . portabilitytest/common.sh test_testexcl
all of the tested shells executed this test successfully
#!/bin/sh test_testeqeq () # nonstandard '[ 1 == 1 ]' ('[ 1 = 1 ]' would be standard one) { # this can be made to pass in zsh by using '==' or w/ unsetopt equals [ 1 == 1 ] } . portabilitytest/common.sh test_testeqeq
+ test_testeqeq + [ 1 == 1 ] portabilitytest/16_test_testeqeq: 5: [: 1: unexpected operator
+ test_testeqeq + [ 1 == 1 ] portabilitytest/16_test_testeqeq: test: unknown operator ==
2 of the tested shells failed to execute this test
#!/bin/sh test_testtest () # whether [[ ]] is supported (with 1 == 1) { [[ 1 == 1 ]] } . portabilitytest/common.sh test_testtest
+ test_testtest + [[ 1 == 1 ]] portabilitytest/17_test_testtest: 4: portabilitytest/17_test_testtest: [[: not found
+ test_testtest + [[ 1 == 1 ]] portabilitytest/17_test_testtest: [[: not found
2 of the tested shells failed to execute this test
#!/bin/sh test_tildexp () # tilde expansion { case ~ in /*) ;; *) exit 1; esac } . portabilitytest/common.sh test_tildexp
+ test_tildexp + exit 1
1 of the tested shells failed to execute this test
#!/bin/sh test_pwdvar () # '$PWD' variable expansion { cd /tmp PWD=/usr echo \$PWD: $PWD cd . echo \$PWD: $PWD case $PWD in /tmp) ;; *) exit 1; esac } . portabilitytest/common.sh test_pwdvar
+ test_pwdvar + cd /tmp PWD=/usr + echo $PWD: /usr $PWD: /usr + cd . + echo $PWD: /usr $PWD: /usr + exit 1
1 of the tested shells failed to execute this test
#!/bin/sh test_pwdcmd () # pwd builtin command { pwd } . portabilitytest/common.sh test_pwdcmd
all of the tested shells executed this test successfully
#!/bin/sh test_true () # true builtin command (cannot test false...) { true } . portabilitytest/common.sh test_true
+ test_true + true portabilitytest/21_test_true: true: not found
1 of the tested shells failed to execute this test
#!/bin/sh test_colon () # colon (:) builtin command { : } . portabilitytest/common.sh test_colon
all of the tested shells executed this test successfully
#!/bin/sh test_export1 () # export VAR=val -- not bourne compatible { export VAR=val case $VAR in val) ;; *) exit 1; esac } . portabilitytest/common.sh test_export1
+ test_export1 + export VAR=val portabilitytest/23_test_export1: VAR=val: is not an identifier
1 of the tested shells failed to execute this test
#!/bin/sh test_readonly2 () # VAR=val; readonly VAR -- then attempt to change VAR { VAR=val; readonly VAR # running in subshell as this makes shell exit. ( VAR=changed || : ) && exit 1 || : } . portabilitytest/common.sh test_readonly2
all of the tested shells executed this test successfully
#!/bin/sh test_case_pxcl () # case where both '*' and '[!a-z0-9_]' unquoted { case test/echo1 in *[!a-z0-9_]*) ;; *) exit 1; esac case test_echo1 in *[!a-z0-9_]*) exit 1; esac } . portabilitytest/common.sh test_case_pxcl
all of the tested shells executed this test successfully
#!/bin/sh test_case_pxcf () # case where both '*' and '[^a-z0-9_]' unquoted { # dash & heirloom sh expected to "fail" here. case test/echo1 in *[^a-z0-9_]*) ;; *) exit 1; esac case test_echo1 in *[^a-z0-9_]*) exit 1; esac } . portabilitytest/common.sh test_case_pxcf
+ test_case_pxcf + exit 1
+ test_case_pxcf + exit 1
+ test_case_pxcf + exit 1
portabilitytest/26_test_case_pxcf: syntax error at line 5: `^' unexpected
4 of the tested shells failed to execute this test
#!/bin/sh test_at0 () # "$@" expansion when $# 0 { case $# in 0) ;; *) die "arg count 0 required for this test" ;; esac : "$@" } . portabilitytest/common.sh test_at0
+ test_at0 portabilitytest/27_test_at0: @: parameter not set
1 of the tested shells failed to execute this test
#!/bin/sh test_at1 () # ${1+"$@"} expansion when $# 0 { case $# in 0) ;; *) die "arg count 0 required for this test" ;; esac : ${1+"$@"} } . portabilitytest/common.sh test_at1
all of the tested shells executed this test successfully
#!/bin/sh test_at0for () # implicit "$@" in for loop { case $# in 0) ;; *) die "arg count 0 required for this test" ;; esac # FreeBSD 7.1 /bin/sh will complain something like $@ not defined for var; do :; done } . portabilitytest/common.sh test_at0for
portabilitytest/29_test_at0for: syntax error at line 6: `;' unexpected
1 of the tested shells failed to execute this test
#!/bin/sh test_echoE () # expect backslash-escapes to be escapes by default { case `echo '\n' | withpath wc` in *2*0*2) ;; *) exit 1; esac } . portabilitytest/common.sh test_echoE
+ test_echoE + echo '\n' + withpath wc + PATH=/bin:/usr/bin + export PATH + wc + PATH='' + export PATH + exit 1
+ test_echoE + echo \n + withpath wc + PATH=/bin:/usr/bin + export PATH + wc + PATH= + export PATH + exit 1
2 of the tested shells failed to execute this test
#!/bin/sh test_echoc () # expect '\c' to stop producing more output { case `echo '\c---'` in '') ;; *) exit 1; esac } . portabilitytest/common.sh test_echoc
+ test_echoc + echo '\c---' + exit 1
+ test_echoc + echo '\c---' + exit 1
+ test_echoc + echo '\c---' + exit 1
+ test_echoc + echo \c--- + exit 1
4 of the tested shells failed to execute this test
#!/bin/sh test_echon () # whether 'echo -n' works { echo -n case `echo -n` in '') ;; *) exit 1; esac } . portabilitytest/common.sh test_echon
+ test_echon + echo -n -n + case `echo -n` in ++ echo -n + exit 1
+ test_echon + echo -n -n + echo -n + exit 1
2 of the tested shells failed to execute this test
#!/bin/sh test_bi_printf () # builtin printf { case `printf '%s' tstr` in tstr) ;; *) exit 1; esac } . portabilitytest/common.sh test_bi_printf
+ test_bi_printf + printf %s tstr portabilitytest/33_test_bi_printf[7]: printf: not found + exit 1
+ test_bi_printf + printf %s tstr portabilitytest/33_test_bi_printf[7]: printf: not found + exit 1
+ test_bi_printf + printf %s tstr portabilitytest/33_test_bi_printf: printf: not found
3 of the tested shells failed to execute this test
#!/bin/sh test_dollar_sg () # dollar-single expansion { x=$'\n' case $x in ?) ;; *) exit 1; esac } . portabilitytest/common.sh test_dollar_sg
+ test_dollar_sg + x=$\n + exit 1
+ test_dollar_sg x=$\n + exit 1
2 of the tested shells failed to execute this test
#!/bin/sh test_hash_fatl () # some shells (heirloom sh) exits when hash fails { if hash xxx_no_such_prog then : fi } . portabilitytest/common.sh test_hash_fatl
+ test_hash_fatl + hash xxx_no_such_prog portabilitytest/35_test_hash_fatl: xxx_no_such_prog: not found
1 of the tested shells failed to execute this test
#!/bin/sh test_hash_btin () # if there is builtin hash { hash /bin/sh || hash sh=/bin/sh # latter for zsh } . portabilitytest/common.sh test_hash_btin
all of the tested shells executed this test successfully
#!/bin/sh test_hash_fail () # if hash fails in case command not found { if (hash this_c0mmand_does_not_existt) # in subshell for heirloom sh... then exit 1 else exit 0 fi } . portabilitytest/common.sh test_hash_fail
+ test_hash_fail + alias -t -- this_c0mmand_does_not_existt + exit 1
+ test_hash_fail + alias -t this_c0mmand_does_not_existt + exit 1
+ test_hash_fail + alias -t this_c0mmand_does_not_existt + exit 1
3 of the tested shells failed to execute this test
#!/bin/sh test_iexpr () # $((a + b)) { a=1 b=2 c=$((a + b)) case $c in 3) ;; *) exit 1; esac } . portabilitytest/common.sh test_iexpr
portabilitytest/38_test_iexpr: syntax error at line 5: `c=$' unexpected
1 of the tested shells failed to execute this test
#!/bin/sh test_tfft () # true && false && false || true { _false () { return 1; } : && _false && _false || : } . portabilitytest/common.sh test_tfft
all of the tested shells executed this test successfully
#!/bin/sh test_icat () # whether there is $(< file) { d=$(< "$0") case $d in '') exit 1; esac } . portabilitytest/common.sh test_icat
+ test_icat + + d= + exit 1
+ test_icat + + d= + exit 1
portabilitytest/40_test_icat: syntax error at line 4: `d=$' unexpected
3 of the tested shells failed to execute this test