]> git.ipfire.org Git - thirdparty/bash.git/blob - tests/array21.sub
d1f705e3dd9e8c686698abb324b9e6c3ced685de
[thirdparty/bash.git] / tests / array21.sub
1 typeset -a a
2 a=(1 2 3 4)
3
4 typeset -A A
5 A=([one]=1 [two]=2 [three]=3 [four]=4)
6
7 unset 'a[0]'
8 typeset -p a
9
10 scalar=abcd
11 echo ${scalar[0]}
12
13 unset 'scalar[0]'
14 echo ${scalar-unset}
15
16 unset 'a[@]'
17 typeset -p a
18
19 unset 'A[@]'
20 typeset -p A
21
22 typeset -a a
23 a=(1 2 3 4)
24 typeset -A A
25 A=([one]=1 [two]=2 [three]=3 [four]=4)
26
27 # supported, recommended way to unset all array elements
28 a=()
29 typeset -p a
30 A=()
31 typeset -p A
32
33 declare -a foo
34 declare foo='(1 2 3)'
35 declare foo[1]='(4 5 6)'
36
37 declare -p foo