]>
Commit | Line | Data |
---|---|---|
8868edaf CR |
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 | # | |
d233b485 CR |
14 | # This isn't perfect behavior, but it establishes a baseline and will provide |
15 | # a way to detect behavior changes | |
16 | ||
17 | echo a1 | |
18 | a[0]= a[1]=; recho "${a[@]:-y}" | |
19 | unset a | |
20 | ||
21 | echo a2 | |
22 | a[1]=; recho "${a[@]:-y}" | |
23 | a[1]=; recho "${a[*]:-z}" | |
24 | unset a | |
25 | ||
26 | echo a3 | |
27 | a[0]= a[1]=x; recho "${a[@]:-y}" | |
28 | unset a | |
29 | ||
30 | echo a4 | |
31 | a[0]= a[1]=x; recho ${a[@]:+y} | |
32 | unset a | |
33 | ||
34 | echo p1 | |
35 | set '' '' | |
36 | recho "${@:-y}" | |
37 | ||
38 | shift $# | |
39 | ||
40 | echo p2 | |
41 | set '' x | |
42 | recho "${@:-y}" | |
43 | ||
44 | shift $# | |
45 | ||
46 | echo p3 | |
47 | set '' x | |
48 | recho ${@:+y} | |
49 | ||
50 | # problems with * and null expansions dating back to bash's earliest days | |
51 | A=(''); set -- '' | |
52 | ||
53 | echo "<${A[*]:-X}>" "<${*:-X}>" "<${A:-X}>" "<${A[0]:-X}>" | |
54 | ||
55 | IFS= | |
56 | A=('' ''); set -- '' '' | |
57 | B='' | |
58 | ||
59 | echo "<${A[*]:-X}>" "<${*:-X}>" "<${B:-X}>" "<${B[*]:-X}>" |