1 ########################################################################
3 # This software is part of the ast package #
4 # Copyright (c) 1982-2010 AT&T Intellectual Property #
5 # and is licensed under the #
6 # Common Public License, Version 1.0 #
7 # by AT&T Intellectual Property #
9 # A copy of the License is available at #
10 # http://www.opensource.org/licenses/cpl1.0.txt #
11 # (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) #
13 # Information and Software Systems Research #
17 # David Korn <dgk@research.att.com> #
19 ########################################################################
23 print
-u2 -r ${Command}[$1]: "${@:2}"
26 alias err_exit
='err_exit $LINENO'
32 x
+=def
;} 2> /dev
/null
34 then err_exit
'abc+def != abcdef'
39 then err_exit
'3+4!=7'
41 iarray
=( one two three
)
42 { iarray
+= (four five six
) ;} 2> /dev
/null
43 if [[ ${iarray[@]} != 'one two three four five six' ]]
44 then err_exit
'index array append fails'
48 { iarray
+= (four five six
) ;} 2> /dev
/null
49 if [[ ${iarray[@]} != 'one four five six' ]]
50 then err_exit
'index array append to scalar fails'
53 aarray
=( [1]=1 [3]=4 [xyz
]=xyz
)
54 aarray
+=( [2]=2 [3]=3 [foo
]=bar
)
55 if [[ ${aarray[3]} != 3 ]]
56 then err_exit
'associative array append fails'
58 if [[ ${#aarray[@]} != 5 ]]
59 then err_exit
'number of elements of associative array append fails'
63 if [[ ${point.y} != 3 ]]
64 then err_exit
'compound append fails'
66 if [[ ${point.x} != 1 ]]
67 then err_exit
'compound append to compound variable unsets existing variables'
72 if [[ ${foo[@]} != 'one two' ]]
73 then err_exit
'array append to non array variable fails'
78 [[ ${foo[1].x} == 4 ]] || err_exit
'compound append to index array not working'
79 [[ ${foo[0].x} == 3 ]] || err_exit
'compound append to index array unsets existing variables'