diff options
author | Roger A. Faulkner <Roger.Faulkner@Oracle.COM> | 2010-04-03 09:48:44 -0700 |
---|---|---|
committer | Roger A. Faulkner <Roger.Faulkner@Oracle.COM> | 2010-04-03 09:48:44 -0700 |
commit | 3e14f97f673e8a630f076077de35afdd43dc1587 (patch) | |
tree | 9828b6b676f58d7b27dd28e00202d3f3461a5cd8 /usr/src/lib/libshell/common/tests/arrays.sh | |
parent | 4f60987df4dcaa54a88b596f861fbf4f3382c65e (diff) | |
download | illumos-gate-3e14f97f673e8a630f076077de35afdd43dc1587.tar.gz |
6939349 RFE: Update ksh93 to ast-ksh.2010-03-09
6877392 ksh93 regresses 'uniq -c' performance
6887363 Korn shell 93 sometimes mishandles return value of its child process
6900314 (while true ; do true|true ; done) hang in ioctl() with SIGTTOU
6904557 wc no longer counts number of bytes correctly
6904575 cut -d with multibyte character no longer works
6904597 paste -d no longer works with multibyte characters
6904780 /usr/bin/cksum changed output in snv_128
6904870 uniq -s does not skip multibyte characters correctly
6904878 join -t no longer works with multibyte char separator
6907460 EXIT trap handlers are sometimes executed twice
6909579 libast getopt solaris compatibility broken
6920072 ksh93 tail -f, with unconditional .25s sleep and line parsing, about 37x slower than cat
6932124 mktemp in ksh93 is broken
Contributed by Olga Kryzhanovska <olga.kryzhanovska@gmail.com>
Diffstat (limited to 'usr/src/lib/libshell/common/tests/arrays.sh')
-rw-r--r-- | usr/src/lib/libshell/common/tests/arrays.sh | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/usr/src/lib/libshell/common/tests/arrays.sh b/usr/src/lib/libshell/common/tests/arrays.sh index 996101409f..a483b50072 100644 --- a/usr/src/lib/libshell/common/tests/arrays.sh +++ b/usr/src/lib/libshell/common/tests/arrays.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2009 AT&T Intellectual Property # +# Copyright (c) 1982-2010 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -336,18 +336,20 @@ unset bam print 'print ${var[0]} ${var[1]}' > $tmp/script chmod +x $tmp/script [[ $($SHELL -c "var=(foo bar);export var;$tmp/script") == foo ]] || err_exit 'export array not exporting just first element' + unset foo -set -o allexport +set --allexport foo=one foo[1]=two foo[0]=three -[[ $foo == three ]] || err_exit 'export all not working with arrays' +[[ $foo == three ]] || err_exit '--allexport not working with arrays' +set --noallexport +unset foo + cat > $tmp/script <<- \! typeset -A foo print foo${foo[abc]} ! -# 04-05-24 bug fix -unset foo [[ $($SHELL -c "typeset -A foo;$tmp/script") == foo ]] 2> /dev/null || err_exit 'empty associative arrays not being cleared correctly before scripts' [[ $($SHELL -c "typeset -A foo;foo[abc]=abc;$tmp/script") == foo ]] 2> /dev/null || err_exit 'associative arrays not being cleared correctly before scripts' unset foo @@ -378,8 +380,12 @@ foo=bar set -- "${foo[@]:1}" (( $# == 0 )) || err_exit '${foo[@]:1} should not have any values' unset bar +exp=4 : ${_foo[bar=4]} -(( bar == 4 )) || err_exit 'subscript of unset variable not evaluated' +(( bar == 4 )) || err_exit "subscript of unset variable not evaluated -- expected '4', got '$got'" +unset bar +: ${_foo[bar=$exp]} +(( bar == $exp )) || err_exit "subscript of unset variable not evaluated -- expected '$exp', got '$got'" unset foo bar foo[5]=4 bar[4]=3 @@ -473,4 +479,23 @@ FILTER[0].scope=include FILTER[1].scope=exclude [[ ${#FILTER[@]} == 2 ]] || err_exit "FILTER array should have two elements not ${#FILTER[@]}" +unset x +function x.get +{ + print sub=${.sh.subscript} +} +x[2]= +z=$(: ${x[1]} ) +[[ $z == sub=1 ]] || err_exit 'get function not invoked for index array' + +unset x +typeset -A x +function x.get +{ + print sub=${.sh.subscript} +} +x[2]= +z=$(: ${x[1]} ) +[[ $z == sub=1 ]] || err_exit 'get function not invoked for associative array' + exit $((Errors)) |