improve of cmpl.
[bush.git] / testing / 3.OriginalTest.dir / varenv / assoc / assoc11.sub
blob13111a52b14a47ccdb275a9eb1ec309cba79dafd
1 #   This program is free software: you can redistribute it and/or modify
2 #   it under the terms of the GNU General Public License as published by
3 #   the Free Software Foundation, either version 3 of the License, or
4 #   (at your option) any later version.
6 #   This program is distributed in the hope that it will be useful,
7 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
8 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9 #   GNU General Public License for more details.
11 #   You should have received a copy of the GNU General Public License
12 #   along with this program.  If not, see <http://www.gnu.org/licenses/>.
14 # these tests were previously in array19.sub, but they are acceptable syntax now
16 declare -A a
17 declare a='(1 2 3)'
18 declare -p a
19 unset a
21 declare -A foo
23 v1='spa ces'
24 v2=@
26 foo=(a 1 b 2 c 3 d 4 )
27 declare -p foo
28 echo foo=\( ${foo[@]@K} \)
30 foo=('a b' 1 "$v1" 2 "$v2" 3 'holy hell this works' 4 \\ 5)
31 declare -p foo
32 echo foo=\( echo ${foo[@]@K} \)
34 foo=( "" null )
36 foo=('a]a' abc ']' def $(echo 'foo[bar') bleh \; semicolon a=b assignment)
37 declare -p foo
38 echo foo=\( ${foo[@]@K} \)
40 foo=('`' backquote '"' dquote "'" squote \\ bslash)
41 declare -p foo
42 echo foo=\( ${foo[@]@K} \)
44 bar='a]=test1;#a'
45 foo=( $bar 123 bar\"bie doll bar]bie doll )
46 declare -p foo
47 echo foo=\( ${foo[@]@K} \)
49 func()
51         declare -A inside=(a 1 b 2 c 3)
52         declare -p inside
53         echo inside=\( ${inside[@]@K} \)
55 func
57 loaddict()
59         dict=( '"' dquote '`' bquote "'" squote '\' bslash)
60         dict+=( '$' dol @ at * star \{ lbrace \} rbrace ? quest)
62         declare -p dict
63         echo dict=\( ${dict[@]@K} \)
65 declare -A dict
66 loaddict
68 foo=(one 1 two)
69 declare -p foo
70 echo foo=\( ${foo[@]@K} \)
72 typeset -A a=( [\\]=bs [\"]=dquote [\)]=rparen [\]]=rbrace )
73 echo ${a[@]}
74 declare -p a
76 echo ${a[@]@K}
77 echo ${a[@]@A}
79 eval "${a[@]@A}"
80 declare -p a
82 eval "a=( ${a[@]@K} )"
83 declare -p a
85 unset a foo
86 readonly -A foo=( one 1 two 2 three 3 )
88 export foo
89 declare -p foo
90 declare foo+=( seven 7 eight 8 )