]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/array.right
Bash-4.4 patch 14
[thirdparty/bash.git] / tests / array.right
CommitLineData
7117c2d2
JA
1
2./array.tests: line 15: syntax error near unexpected token `&'
3./array.tests: line 15: `test=(first & second)'
bb70624e 41
ccc6cda3 5abcde
d166f048 6abcde
ccc6cda3
JA
7abcde bdef
8abcde bdef
a0c0a00f
CR
9declare -a BASH_ARGC=()
10declare -a BASH_ARGV=()
11declare -a BASH_LINENO=([0]="0")
12declare -a BASH_SOURCE=([0]="./array.tests")
13declare -a DIRSTACK=()
14declare -a FUNCNAME
15declare -a a=([0]="abcde" [1]="" [2]="bdef")
16declare -a b
17declare -ar c
ccc6cda3
JA
18abcde bdef
19abcde bdef
20abcde
21abcde
22abcde
23
24bdef
25hello world
2611
273
0001803f
CR
28bdef hello world test expression test 2
29./array.tests: line 76: readonly: `a[5]': not a valid identifier
a0c0a00f
CR
30declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
31declare -ar c
32declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
33declare -ar c
34readonly -a a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
35readonly -a c
ccc6cda3 36a test
a0c0a00f
CR
37declare -a BASH_ARGC=()
38declare -a BASH_ARGV=()
39declare -a BASH_LINENO=([0]="0")
40declare -a BASH_SOURCE=([0]="./array.tests")
41declare -a DIRSTACK=()
42declare -a FUNCNAME
43declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
44declare -a b=([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")
45declare -ar c
46declare -a d=([1]="" [2]="bdef" [5]="hello world" [6]="test" [9]="ninth element")
47declare -a e=([0]="test")
48declare -a f=([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")
0001803f
CR
49./array.tests: line 100: a: readonly variable
50./array.tests: line 102: b[]: bad array subscript
51./array.tests: line 103: b[*]: bad array subscript
52./array.tests: line 104: ${b[ ]}: bad substitution
53./array.tests: line 106: c[-2]: bad array subscript
54./array.tests: line 107: c: bad array subscript
ccc6cda3 55
0001803f
CR
56./array.tests: line 109: d[7]: cannot assign list to array member
57./array.tests: line 111: []=abcde: bad array subscript
58./array.tests: line 111: [*]=last: cannot assign to non-numeric index
59./array.tests: line 111: [-65]=negative: bad array subscript
a0c0a00f
CR
60declare -a BASH_ARGC=()
61declare -a BASH_ARGV=()
62declare -a BASH_LINENO=([0]="0")
63declare -a BASH_SOURCE=([0]="./array.tests")
64declare -a DIRSTACK=()
65declare -a FUNCNAME
66declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
67declare -a b=([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")
68declare -ar c
69declare -a d=([1]="test test")
70declare -a f=([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")
0001803f
CR
71./array.tests: line 119: unset: ps1: not an array variable
72./array.tests: line 123: declare: c: cannot destroy array variables in this way
ccc6cda3
JA
73this of
74this is a test of read using arrays
cce855bc
JA
75this test
76this is a test of arrays
a0c0a00f
CR
77declare -a BASH_ARGC=()
78declare -a BASH_ARGV=()
79declare -a BASH_LINENO=([0]="0")
80declare -a BASH_SOURCE=([0]="./array.tests")
81declare -a DIRSTACK=()
82declare -a FUNCNAME
83declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
84declare -a b=([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")
85declare -ar c
86declare -a d=([1]="test test")
87declare -a f=([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")
88declare -a rv=([0]="this" [1]="is" [2]="a" [3]="test" [4]="of" [5]="read" [6]="using" [7]="arrays")
ccc6cda3
JA
89abde
90abde
91bbb
92efgh
93wxyz
94wxyz
95./array.tests
96a
97b c
98d
99e f g
100h
101./array.tests
102a
103b c
104d
105e f g
106h
d166f048
JA
107/bin /usr/bin /usr/ucb /usr/local/bin . /sbin /usr/sbin
108bin bin ucb bin . sbin sbin
109bin
110/ / / / / /
111/
7117c2d2
JA
112argv[1] = <bin>
113argv[1] = </>
114argv[1] = <sbin>
115argv[1] = </>
d166f048
JA
116\bin \usr/bin \usr/ucb \usr/local/bin . \sbin \usr/sbin
117\bin \usr\bin \usr\ucb \usr\local\bin . \sbin \usr\sbin
118\bin \usr\bin \usr\ucb \usr\local\bin . \sbin \usr\sbin
1194 -- 4
1207 -- 7
12155
12249
1236 -- 6
12442 14 44
125grep [ 123 ] *
1266 7 9
1276 7 9 5
cce855bc
JA
128length = 3
129value = new1 new2 new3
0001803f 130./array.tests: line 239: narray: unbound variable
95732b49
JA
131./array1.sub: line 1: syntax error near unexpected token `('
132./array1.sub: line 1: `printf "%s\n" -a a=(a 'b c')'
ac50fbac
CR
133./array2.sub: line 1: declare: `[]=asdf': not a valid identifier
134./array2.sub: line 2: a[]: bad array subscript
135./array2.sub: line 4: syntax error near unexpected token `('
136./array2.sub: line 4: `declare -a ''=(a 'b c')'
95732b49
JA
1379
1389
139
140
1417 8 9
0628567a
JA
1428 11
1438 11
1446
1456
146nordholz
1478
1488
1498
bb70624e
JA
150
151a b c d e f g
152for case if then else
153<> < > !
15412 14 16 18 20
1554414758999202
28ef6c31 156aaa bbb
0001803f
CR
157./array.tests: line 289: syntax error near unexpected token `<>'
158./array.tests: line 289: `metas=( <> < > ! )'
159./array.tests: line 290: syntax error near unexpected token `<>'
160./array.tests: line 290: `metas=( [1]=<> [2]=< [3]=> [4]=! )'
28ef6c31 161abc 3
7117c2d2
JA
162case 4
163abc case if then else 5
164abc case if then else 5
28ef6c31 1650
7117c2d2
JA
166case 4
167case if then else 5
168case if then else 5
b80f6443
JA
169argv[1] = <0>
170argv[2] = <1>
171argv[3] = <4>
172argv[4] = <10>
173argv[1] = <0>
174argv[2] = <1>
175argv[3] = <4>
176argv[4] = <10>
177argv[1] = <0>
178argv[2] = <1>
179argv[3] = <4>
180argv[4] = <10>
181argv[1] = <0 1 4 10>
182include null element -- expect one
183one
184include unset element -- expect three five
185three five
186start at unset element -- expect five seven
187five seven
188too many elements -- expect three five seven
189three five seven
190positive offset - expect five seven
191five seven
eb873671
JA
192negative offset to unset element - expect seven
193seven
b80f6443
JA
194positive offset 2 - expect seven
195seven
196negative offset 2 - expect seven
197seven
198out-of-range offset
199
95732b49
JA
200e
2014
2021 4 7 10
203'b
204b c
205$0
206t
207[3]=abcde r s t u v
208e
2099
0628567a 2102
3185942a 211a b c
ac50fbac
CR
212argv[1] = <-iname 'a>
213argv[2] = <-iname 'b>
214argv[3] = <-iname 'c>
3185942a
JA
215'hey'
216hey
217''hey
218'hey'
219argv[1] = <c>
220argv[2] = <d>
221argv[3] = <e>
222argv[4] = <f>
223argv[1] = <c d>
224argv[2] = <e f>
225argv[1] = <c d>
226argv[2] = <e f>
227argv[1] = <c d>
228argv[2] = <e f>
3185942a
JA
229argv[1] = <-iname 'abc>
230argv[2] = <-iname 'def>
ac50fbac
CR
231argv[1] = <-iname 'abc>
232argv[2] = <-iname 'def>
3185942a 233argv[1] = <-iname>
ac50fbac
CR
234argv[2] = <abc -iname def>
235argv[1] = <-iname 'abc>
236argv[2] = <-iname 'def>
237argv[1] = <-iname>
238argv[2] = <abc -iname def>
239argv[1] = <-iname 'abc>
240argv[2] = <-iname 'def>
3185942a
JA
241argv[1] = <-iname 'abc>
242argv[2] = <-iname 'def>
ac50fbac
CR
243argv[1] = <-iname>
244argv[2] = <abc -iname def>
3185942a
JA
245*.* OK
2461
247a1 2 3c
248argv[1] = <var with spaces>
249argv[1] = <var with spaces>
250argv[1] = <var with spacesab>
251argv[2] = <cd>
252argv[3] = <ef>
253argv[1] = <var with spacesab>
254argv[2] = <cd>
255argv[3] = <ef>
256argv[1] = <var with spacesab>
257argv[2] = <cd>
258argv[3] = <ef>
259argv[1] = <var with spacesab>
260argv[2] = <cd>
261argv[3] = <ef>
262argv[1] = <var with spacesab>
263argv[2] = <cd>
264argv[3] = <ef>
265argv[1] = <var with spacesab>
266argv[2] = <cd>
267argv[3] = <ef>
2682
269argv[1] = <element1 with spaces>
270argv[2] = <element2 with spaces>
271argv[1] = <element1 with spaces>
272argv[2] = <element2 with spaces>
273nord!olz
274
275rdholz
276
277rdholz
278rdho
279
280
281argv[1] = <fooq//barq/>
282argv[1] = <fooq>
283argv[2] = <>
284argv[3] = <barq>
285argv[4] = <>
286argv[1] = <foo!//bar!/>
287argv[1] = <foo!>
288argv[2] = <>
289argv[3] = <bar!>
290argv[4] = <>
291argv[1] = <ooq//arq/>
292argv[1] = <ooq>
293argv[2] = <>
294argv[3] = <arq>
295argv[4] = <>
296argv[1] = <Fooq//Barq/>
297argv[1] = <Fooq>
298argv[2] = <>
299argv[3] = <Barq>
300argv[4] = <>
301argv[1] = <FOOQ//BARQ/>
302argv[1] = <FOOQ>
303argv[2] = <>
304argv[3] = <BARQ>
305argv[4] = <>
306126
307127
308128
309