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
26 foo=(a 1 b 2 c 3 d 4 )
28 echo foo=\( ${foo[@]@K} \)
30 foo=('a b' 1 "$v1" 2 "$v2" 3 'holy hell this works' 4 \\ 5)
32 echo foo=\( echo ${foo[@]@K} \)
36 foo=('a]a' abc ']' def $(echo 'foo[bar') bleh \; semicolon a=b assignment)
38 echo foo=\( ${foo[@]@K} \)
40 foo=('`' backquote '"' dquote "'" squote \\ bslash)
42 echo foo=\( ${foo[@]@K} \)
45 foo=( $bar 123 bar\"bie doll bar]bie doll )
47 echo foo=\( ${foo[@]@K} \)
51 declare -A inside=(a 1 b 2 c 3)
53 echo inside=\( ${inside[@]@K} \)
59 dict=( '"' dquote '`' bquote "'" squote '\' bslash)
60 dict+=( '$' dol @ at * star \{ lbrace \} rbrace ? quest)
63 echo dict=\( ${dict[@]@K} \)
70 echo foo=\( ${foo[@]@K} \)
72 typeset -A a=( [\\]=bs [\"]=dquote [\)]=rparen [\]]=rbrace )
82 eval "a=( ${a[@]@K} )"
86 readonly -A foo=( one 1 two 2 three 3 )
90 declare foo+=( seven 7 eight 8 )