]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/array22.sub
bash-5.0 distribution sources and documentation
[thirdparty/bash.git] / tests / array22.sub
CommitLineData
d233b485
CR
1# This isn't perfect behavior, but it establishes a baseline and will provide
2# a way to detect behavior changes
3
4echo a1
5a[0]= a[1]=; recho "${a[@]:-y}"
6unset a
7
8echo a2
9a[1]=; recho "${a[@]:-y}"
10a[1]=; recho "${a[*]:-z}"
11unset a
12
13echo a3
14a[0]= a[1]=x; recho "${a[@]:-y}"
15unset a
16
17echo a4
18a[0]= a[1]=x; recho ${a[@]:+y}
19unset a
20
21echo p1
22set '' ''
23recho "${@:-y}"
24
25shift $#
26
27echo p2
28set '' x
29recho "${@:-y}"
30
31shift $#
32
33echo p3
34set '' x
35recho ${@:+y}
36
37# problems with * and null expansions dating back to bash's earliest days
38A=(''); set -- ''
39
40echo "<${A[*]:-X}>" "<${*:-X}>" "<${A:-X}>" "<${A[0]:-X}>"
41
42IFS=
43A=('' ''); set -- '' ''
44B=''
45
46echo "<${A[*]:-X}>" "<${*:-X}>" "<${B:-X}>" "<${B[*]:-X}>"