]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/array.right
Imported from ../bash-3.1.tar.gz.
[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
b80f6443
JA
9declare -a BASH_ARGC='()'
10declare -a BASH_ARGV='()'
11declare -a BASH_LINENO='([0]="0")'
12declare -a BASH_SOURCE='([0]="./array.tests")'
ccc6cda3 13declare -a DIRSTACK='()'
b80f6443 14declare -a FUNCNAME='([0]="main")'
ccc6cda3
JA
15declare -a a='([0]="abcde" [1]="" [2]="bdef")'
16declare -a b='()'
17declare -ar c='()'
18abcde bdef
19abcde bdef
20abcde
21abcde
22abcde
23
24bdef
25hello world
2611
273
28bdef hello world test expression
7117c2d2 29./array.tests: line 74: readonly: `a[5]': not a valid identifier
ccc6cda3
JA
30declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
31declare -ar c='()'
32declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
33declare -ar c='()'
cce855bc
JA
34readonly -a a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
35readonly -a c='()'
ccc6cda3 36a test
b80f6443
JA
37declare -a BASH_ARGC='()'
38declare -a BASH_ARGV='()'
39declare -a BASH_LINENO='([0]="0")'
40declare -a BASH_SOURCE='([0]="./array.tests")'
ccc6cda3 41declare -a DIRSTACK='()'
b80f6443 42declare -a FUNCNAME='([0]="main")'
ccc6cda3
JA
43declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
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")'
7117c2d2
JA
49./array.tests: line 98: a: readonly variable
50./array.tests: line 100: b[]: bad array subscript
51./array.tests: line 101: b[*]: bad array subscript
52./array.tests: line 102: ${b[ ]}: bad substitution
53./array.tests: line 104: c[-2]: bad array subscript
54./array.tests: line 105: c: bad array subscript
ccc6cda3 55
7117c2d2
JA
56./array.tests: line 107: d[7]: cannot assign list to array member
57./array.tests: line 109: []=abcde: bad array subscript
58./array.tests: line 109: [*]=last: cannot assign to non-numeric index
59./array.tests: line 109: [-65]=negative: bad array subscript
b80f6443
JA
60declare -a BASH_ARGC='()'
61declare -a BASH_ARGV='()'
62declare -a BASH_LINENO='([0]="0")'
63declare -a BASH_SOURCE='([0]="./array.tests")'
ccc6cda3 64declare -a DIRSTACK='()'
b80f6443 65declare -a FUNCNAME='([0]="main")'
ccc6cda3
JA
66declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
67declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
68declare -ar c='()'
e8ce775d 69declare -a d='([1]="test test")'
ccc6cda3 70declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")'
7117c2d2
JA
71./array.tests: line 117: unset: ps1: not an array variable
72./array.tests: line 121: 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
b80f6443
JA
77declare -a BASH_ARGC='()'
78declare -a BASH_ARGV='()'
79declare -a BASH_LINENO='([0]="0")'
80declare -a BASH_SOURCE='([0]="./array.tests")'
ccc6cda3 81declare -a DIRSTACK='()'
b80f6443 82declare -a FUNCNAME='([0]="main")'
ccc6cda3
JA
83declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
84declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
85declare -ar c='()'
e8ce775d 86declare -a d='([1]="test test")'
ccc6cda3 87declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")'
d166f048 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
7117c2d2 130./array.tests: line 237: 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')'
133./array2.sub: line 1: syntax error near unexpected token `('
134./array2.sub: line 1: `declare -a ''=(a 'b c')'
1359
1369
137
138
1397 8 9
bb70624e
JA
140
141a b c d e f g
142for case if then else
143<> < > !
14412 14 16 18 20
1454414758999202
28ef6c31 146aaa bbb
95732b49
JA
147./array.tests: line 282: syntax error near unexpected token `<>'
148./array.tests: line 282: `metas=( <> < > ! )'
149./array.tests: line 283: syntax error near unexpected token `<>'
150./array.tests: line 283: `metas=( [1]=<> [2]=< [3]=> [4]=! )'
28ef6c31 151abc 3
7117c2d2
JA
152case 4
153abc case if then else 5
154abc case if then else 5
28ef6c31 1550
7117c2d2
JA
156case 4
157case if then else 5
158case if then else 5
b80f6443
JA
159argv[1] = <0>
160argv[2] = <1>
161argv[3] = <4>
162argv[4] = <10>
163argv[1] = <0>
164argv[2] = <1>
165argv[3] = <4>
166argv[4] = <10>
167argv[1] = <0>
168argv[2] = <1>
169argv[3] = <4>
170argv[4] = <10>
171argv[1] = <0 1 4 10>
172include null element -- expect one
173one
174include unset element -- expect three five
175three five
176start at unset element -- expect five seven
177five seven
178too many elements -- expect three five seven
179three five seven
180positive offset - expect five seven
181five seven
eb873671
JA
182negative offset to unset element - expect seven
183seven
b80f6443
JA
184positive offset 2 - expect seven
185seven
186negative offset 2 - expect seven
187seven
188out-of-range offset
189
95732b49
JA
190e
1914
1921 4 7 10
193'b
194b c
195$0
196t
197[3]=abcde r s t u v
198e
1999