]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/assoc16.sub
Bash-5.2-rc4 release
[thirdparty/bash.git] / tests / assoc16.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
15# bash versions up to and including bash-5.1 expanded these subscripts more
16# than once
17
18declare -A A
19
20A["Darwin"]=darjeeling
21A['$(echo Darwin ; echo stderr>&2)']=darjeeling
22
23declare -p A
24
25echo ${A[$(echo Darwin ; echo stderr>&2)]//eel/shark}
26echo ${A['$(echo Darwin ; echo stderr>&2)']//eel/shark}
27
28echo ${A[$(echo Darwin ; echo stderr>&2)]:0:4}
29echo ${A['$(echo Darwin ; echo stderr>&2)']:0:4}
30
31echo ${A[$(echo Darwin ; echo stderr>&2)]^^}
32echo ${A['$(echo Darwin ; echo stderr>&2)']^^}
33
34echo ${A[$(echo Darwin ; echo stderr>&2)]@Q}
35echo ${A['$(echo Darwin ; echo stderr>&2)']@Q}
36
37echo ${A[$(echo Darwin ; echo stderr>&2)]%ing}
38echo ${A['$(echo Darwin ; echo stderr>&2)']%ing}
39
40echo ${#A[$(echo Darwin ; echo stderr>&2)]}
41echo ${#A['$(echo Darwin ; echo stderr>&2)']}
42
43echo ${A[$(echo Darwin ; echo stderr>&2)]:-value}
44echo ${A['$(echo Darwin ; echo stderr>&2)']:-value}
45
46echo ${A[$(echo Darwin ; echo stderr>&2)]:+set}
47echo ${A['$(echo Darwin ; echo stderr>&2)']:+set}
48
49echo ${A[$(echo Darwin ; echo stderr>&2)]:+set}
50echo ${A['$(echo Darwin ; echo stderr>&2)']:+set}
51
52darjeeling=7*6
53Darwin=7*4
54
55echo $(( ${A[$(echo Darwin ; echo stderr>&2)]} ))
56echo $(( ${A['$(echo Darwin ; echo stderr>&2)']} ))