]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/new-exp5.sub
Bash-4.3 patch 7
[thirdparty/bash.git] / tests / new-exp5.sub
CommitLineData
95732b49
JA
1x=(one two)
2echo ${x[@]:1}
3echo ${x[@]:0:1}
4
5x=(one)
6echo ${x[0]:1}
7echo ${x[0]:0}
8echo ${x[@]:1}
9echo ${x[@]:0}
10
11echo ${x[@]: -1}
12echo ${x[@]: ${#x[@]}-1}
13
14x=(0 1 2 3 4 5 6 7 8 9)
15echo ${x[@]:1}
16
17echo ${x[@]: -1}
18echo ${x[@]: ${#x[@]}-1}
19
20set -- ${x[@]}
21
22echo $1
23echo ${@: -1}
24echo ${@: $#-1}
25
26a=0123456789
27
28echo ${a:1}
29echo ${a: -1}
30echo ${a: ${#a}-1}
3185942a
JA
31
32# problem with bash through 3.2.33
33oIFS="$IFS"
34IFS=$'\n'
35a=(A B C D)
36b=("${a[@]}")
37echo "${#b[@]}", "${b[@]}" # 4, A B C D -- OK
38b=("${a[@]:2}")
39echo "${#b[@]}", "${b[@]}" # 1, C D -- bug, should be 2, C D
40IFS="$oIFS"