]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/new-exp9.sub
Bash-4.4 patch 14
[thirdparty/bash.git] / tests / new-exp9.sub
CommitLineData
ac50fbac
CR
1indirarray()
2{
3 local intermediary
4 local sub
5
6 intermediary="${1}[@]"
7 local -a leftValue=("${!intermediary}")
8
9 local -a leftSub
10 eval leftSub=(\"\${!${1}[@]}\")
11
12 echo "$1" Value = ${leftValue[@]}
13 echo "$1" Sub = ${leftSub[@]}
14}
15
16a=(1 2 3 4 5)
17b=(a b c d e)
18
19c=([0]=10 [2]=20 [4]=40 [8]=80)
20
21indirarray a
22indirarray b
23indirarray c
24
25ref=a
26tmp="$ref[@]"
27printf "<%s> " "${!tmp}"; echo # Iterate whole array.
28
29ref=c
30tmp="$ref[@]"
31printf "<%s> " "${!tmp}"; echo # Iterate whole array.