]> git.ipfire.org Git - thirdparty/bash.git/blob - tests/assoc17.sub
bash-5.2 distribution sources and documentation
[thirdparty/bash.git] / tests / assoc17.sub
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.
5 #
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.
10 #
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/>.
13 #
14 # test behavior with `unset' and `[' and ']' subscripts
15
16 declare -A A
17 rkey=']'
18 lkey='['
19
20 A[$rkey]=rbracket
21 A[$lkey]=lbracket
22 declare -p A
23
24 unset A[$rkey]
25 unset A[$lkey]
26 declare -p A
27
28 A["$rkey"]=rbracket
29 A["$lkey"]=lbracket
30 declare -p A
31
32 unset A["$rkey"]
33 unset A["$lkey"]
34 declare -p A
35
36 A[\]]=rbracket
37 A[\[]=lbracket
38 declare -p A
39
40 unset A[\]]
41 unset A[\[]
42 declare -p A
43
44 A[']']=rbracket
45 A['[']=lbracket
46 declare -p A
47
48 unset A[']']
49 unset A['[']
50 declare -p A
51
52 A["]"]=rbracket
53 A["["]=lbracket
54 declare -p A
55
56 unset A["]"]
57 unset A["["]
58 declare -p A