]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/assoc17.sub
Bash-5.2-rc4 release
[thirdparty/bash.git] / tests / assoc17.sub
CommitLineData
4491c030
CR
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
16declare -A A
17rkey=']'
18lkey='['
19
20A[$rkey]=rbracket
21A[$lkey]=lbracket
22declare -p A
23
24unset A[$rkey]
25unset A[$lkey]
26declare -p A
27
28A["$rkey"]=rbracket
29A["$lkey"]=lbracket
30declare -p A
31
32unset A["$rkey"]
33unset A["$lkey"]
34declare -p A
35
36A[\]]=rbracket
37A[\[]=lbracket
38declare -p A
39
40unset A[\]]
41unset A[\[]
42declare -p A
43
44A[']']=rbracket
45A['[']=lbracket
46declare -p A
47
48unset A[']']
49unset A['[']
50declare -p A
51
52A["]"]=rbracket
53A["["]=lbracket
54declare -p A
55
56unset A["]"]
57unset A["["]
58declare -p A