]> git.ipfire.org Git - thirdparty/bash.git/blob - tests/new-exp13.sub
Bash-5.2-rc4 release
[thirdparty/bash.git] / tests / new-exp13.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
15 declare -lr VAR1
16 declare -lr VAR2=zzz
17 declare -alr VAR3
18
19 var=VAR2
20
21 echo ${!var@Q}
22 echo ${VAR2@Q}
23
24 echo ${VAR1@A}
25 echo ${VAR1[@]@A}
26 echo "${VAR1@A}"
27 echo "${VAR1[@]@A}"
28
29 echo "${VAR1[@]@a}"
30 echo ${VAR1[@]@a}
31 echo "${VAR1@a}"
32 echo ${VAR1@a}
33
34 echo ${VAR3@A}
35 echo ${VAR3[@]@A}
36 echo "${VAR3@A}"
37 echo "${VAR3[@]@A}"
38
39 echo "${VAR3[@]@a}"
40 echo ${VAR3[@]@a}
41 echo "${VAR3@a}"
42 echo ${VAR3@a}
43
44 var=one
45
46 echo ${var}
47 echo ${var[@]}
48
49 VAR4=(aaa bbb)
50
51 varname=VAR4
52
53 echo ${!varname[@]@Q}
54
55 echo ${VAR4[@]@Q}
56 echo ${!VAR4[@]@Q}
57
58 echo ${VAR4[@]}
59 echo ${!VAR4[@]}
60
61 VAR5=(aaa bbb)
62 varname="VAR5[@]"
63
64 echo "${VAR5@Q}"
65 echo "${VAR5[@]@Q}"
66
67 echo "${!varname@Q}"
68 echo "${!varname[@]@Q}"
69
70 # caused core dumps through bash-5.0
71 echo "${!varname##aa}"
72 echo "${!varname[@]%b}"