Solaris 10: bash 3.2.41, zsh 4.2.1, ksh88? dtksh=ksh93?
The shells available in Solaris 10 default install…
That test_echoc
zsh failure can probably be sorted out by yet
another zsh option – unsetopt bsd_echo
was not enough…
Shells: /bin/sh, /bin/ksh, /bin/bash, /bin/zsh, /usr/dt/bin/dtksh
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: builtin: not found
+ test_builtin portabilitytest/04_test_builtin[8]: restricted: echo is a shell builtin portabilitytest/04_test_builtin[3]: builtin: not found
2 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: local: not found
+ test_local + local var=lval portabilitytest/05_test_local: line 8: 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 + typeset var=lval portabilitytest/06_test_typeset: typeset: not found
+ test_typeset + var=lval + typeset var + lt + var=ilval + typeset var + exit 1
2 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: inner: not found portabilitytest/08_test_function: syntax error at line 6: `}' unexpected
1 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[2]: syntax error at line 4 : `(' unexpected
portabilitytest/09_test_function2: syntax error at line 4: `(' unexpected
3 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.MNaynf ev=1 + trap /bin/rm -rf $td; exit $ev 0 + : + /bin/ln /tmp/tmp.MNaynf/file1 /tmp/tmp.MNaynf/file2 + test /tmp/tmp.MNaynf/file1 -ef /tmp/tmp.MNaynf/file2 portabilitytest/13_test_test_ef: test: unknown operator -ef + /bin/rm -rf /tmp/tmp.MNaynf + 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.NaaOrf ev=1 + : + test /tmp/tmp.NaaOrf/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: test: unknown operator ==
1 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: [[: not found
1 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
portabilitytest/26_test_case_pxcf: syntax error at line 5: `^' unexpected
+ test_case_pxcf
+ test_case_pxcf + exit 1
3 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
+ test_at0 portabilitytest/27_test_at0[3]: @: parameter not set
+ test_at0 portabilitytest/27_test_at0: line 5: @: parameter not set
3 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
1 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
+portabilitytest/31_test_echoc:7> test_echoc +test_echoc:1> echo '\c---' +test_echoc:2> case --- () +test_echoc:2> case --- (*) +test_echoc:2> exit 1
1 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 + echo -n + exit 1
+ test_echon -n
+ test_echon + echo -n -n + echo -n + exit 1
3 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: printf: not found
+ test_bi_printf portabilitytest/33_test_bi_printf[7]: printf: not found
2 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
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
+ test_hash_fail + alias -t -- this_c0mmand_does_not_existt + exit 1
2 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
portabilitytest/40_test_icat: syntax error at line 4: `d=$' unexpected
1 of the tested shells failed to execute this test