2 ./array.tests: line 15: syntax error near unexpected token `&'
3 ./array.tests: line 15: `test=(first & second)'
9 declare -a BASH_ARGC=()
10 declare -a BASH_ARGV=()
11 declare -a BASH_LINENO=([0]="0")
12 declare -a BASH_SOURCE=([0]="./array.tests")
13 declare -a DIRSTACK=()
15 declare -a a=([0]="abcde" [1]="" [2]="bdef")
28 bdef hello world test expression test 2
29 ./array.tests: line 76: readonly: `a[5]': not a valid identifier
30 declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
32 declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
34 readonly -a a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
37 declare -a BASH_ARGC=()
38 declare -a BASH_ARGV=()
39 declare -a BASH_LINENO=([0]="0")
40 declare -a BASH_SOURCE=([0]="./array.tests")
41 declare -a DIRSTACK=()
43 declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
44 declare -a b=([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")
46 declare -a d=([1]="" [2]="bdef" [5]="hello world" [6]="test" [9]="ninth element")
47 declare -a e=([0]="test")
48 declare -a f=([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")
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
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
60 declare -a BASH_ARGC=()
61 declare -a BASH_ARGV=()
62 declare -a BASH_LINENO=([0]="0")
63 declare -a BASH_SOURCE=([0]="./array.tests")
64 declare -a DIRSTACK=()
66 declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
67 declare -a b=([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")
69 declare -a d=([1]="test test")
70 declare -a f=([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")
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
74 this is a test of read using arrays
76 this is a test of arrays
77 declare -a BASH_ARGC=()
78 declare -a BASH_ARGV=()
79 declare -a BASH_LINENO=([0]="0")
80 declare -a BASH_SOURCE=([0]="./array.tests")
81 declare -a DIRSTACK=()
83 declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
84 declare -a b=([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")
86 declare -a d=([1]="test test")
87 declare -a f=([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")
88 declare -a rv=([0]="this" [1]="is" [2]="a" [3]="test" [4]="of" [5]="read" [6]="using" [7]="arrays")
107 /bin /usr/bin /usr/ucb /usr/local/bin . /sbin /usr/sbin
108 bin bin ucb bin . sbin sbin
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
129 value = new1 new2 new3
130 ./array.tests: line 239: narray: unbound variable
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: 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')'
152 for case if then else
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]=! )'
163 abc case if then else 5
164 abc case if then else 5
182 include null element -- expect one
184 include unset element -- expect three five
186 start at unset element -- expect five seven
188 too many elements -- expect three five seven
190 positive offset - expect five seven
192 negative offset to unset element - expect seven
194 positive offset 2 - expect seven
196 negative offset 2 - expect seven
212 argv[1] = <-iname 'a>
213 argv[2] = <-iname 'b>
214 argv[3] = <-iname 'c>
229 argv[1] = <-iname 'abc>
230 argv[2] = <-iname 'def>
231 argv[1] = <-iname 'abc>
232 argv[2] = <-iname 'def>
234 argv[2] = <abc -iname def>
235 argv[1] = <-iname 'abc>
236 argv[2] = <-iname 'def>
238 argv[2] = <abc -iname def>
239 argv[1] = <-iname 'abc>
240 argv[2] = <-iname 'def>
241 argv[1] = <-iname 'abc>
242 argv[2] = <-iname 'def>
244 argv[2] = <abc -iname def>
248 argv[1] = <var with spaces>
249 argv[1] = <var with spaces>
250 argv[1] = <var with spacesab>
253 argv[1] = <var with spacesab>
256 argv[1] = <var with spacesab>
259 argv[1] = <var with spacesab>
262 argv[1] = <var with spacesab>
265 argv[1] = <var with spacesab>
269 argv[1] = <element1 with spaces>
270 argv[2] = <element2 with spaces>
271 argv[1] = <element1 with spaces>
272 argv[2] = <element2 with spaces>
281 argv[1] = <fooq//barq/>
286 argv[1] = <foo!//bar!/>
291 argv[1] = <ooq//arq/>
296 argv[1] = <Fooq//Barq/>
301 argv[1] = <FOOQ//BARQ/>
319 Monday Tuesday Wednesday Thursday Friday Saturday Sunday
332 monday, monday, tuesday
333 wednesday, wednesday, thursday
334 monday, monday, tuesday
335 Wednesday, Wednesday, Thursday
352 version[agent] foo[bar]
367 declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="5")
368 declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4")
369 declare -a x=([0]="0" [1]="1" [2]="2" [4]="4")
370 ./array14.sub: line 11: unset: [-10]: bad array subscript
371 declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4")
372 declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="five")
373 declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="5")
374 declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="foo")
375 declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="5")
376 declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4four" [5]="5")
385 foo: implicit reference to element 0: ok
386 foo: arithmetic evaluation: ok
387 bar: array with element zero unset: ok
388 bar: element zero: ok
390 qux: unset array element 0: ok
413 ./array17.sub: line 76: ~ : syntax error: operand expected (error token is "~ ")
435 declare -a foo=([0]="( zeroind )")
436 declare -a foo=([0]="zeroind")
437 declare -a foo=([0]="zeroind")
438 declare -a foo=([0]="[0]=bar")
439 declare -a foo=([0]="[0]=bar")
440 declare -a foo=([0]="[0]=bar")
441 declare -- a="(1 2 3)"
442 declare -a a=([0]="1" [1]="2" [2]="3")
443 ./array19.sub: line 46: a: 1: must use subscript when assigning associative array
444 ./array19.sub: line 46: a: 2: must use subscript when assigning associative array
445 ./array19.sub: line 46: a: 3: must use subscript when assigning associative array
447 declare -- a="([0]=a [1]=b)"
448 declare -a a=([0]="a" [1]="b")
449 declare -A a=([0]="a" [1]="b" )
450 declare -a var=([0]="[\$(echo" [1]="total" [2]="0)]=1" [3]="[2]=2]")
451 declare -a var=([0]="[\$(echo total 0)]=1 [2]=2]")
452 declare -a var=([0]="[\$(echo" [1]="total" [2]="0)]=1" [3]="[2]=2]")
453 ./array19.sub: line 81: total 0: syntax error in expression (error token is "0")
455 declare -al foo=([0]="abcde" [1]="two" [2]="three")
456 declare -al foo=([0]="abcde")
457 declare -al ar=([0]="one" [1]="two" [2]="three")
458 declare -a a=([2]="foo")
459 declare -a a=([2]="foo")
460 declare -a a=([1]="(var)" [2]="foo")
461 ./array19.sub: line 120: warning: a[1]=(var): quoted compound array assignment deprecated
462 declare -a a=([1]="(var)")
463 declare -a a=([0]="1" [1]="2" [2]="(1 2 3)")
464 declare -a a=([0]="1" [1]="2" [2]="(1 2 3)")
465 declare -a a=([0]="1" [1]="2" [2]="3")
466 declare -a a=([0]="1" [1]="2" [2]="3")
467 declare -a a=([0]="1" [1]="2" [2]="3")
469 declare -- b="/scratch/bash"
472 declare -- e="(\$(echo Darwin))"
473 declare -a a=([0]="a b")
474 declare -a b=([0]="/scratch/bash")
475 declare -a c=([0]="1" [1]="2")
476 declare -a d=([0]="a" [1]="b")
477 declare -a e=([0]="Darwin")
478 ./array19.sub: line 166: c: 1: must use subscript when assigning associative array
479 ./array19.sub: line 166: c: 2: must use subscript when assigning associative array
480 ./array19.sub: line 166: d: $a: must use subscript when assigning associative array
481 ./array19.sub: line 166: e: $(echo Darwin): must use subscript when assigning associative array
482 declare -A a=([0]="a b" )
483 declare -A b=([0]="/scratch/bash" )
491 argv[1] = <a+b+c+d+e+f>
492 argv[1] = <x+b+c+d+e+f>
497 declare -a a=([1]="2" [2]="3" [3]="4")
500 ./array21.sub: line 17: typeset: a: not found
501 ./array21.sub: line 20: typeset: A: not found
504 declare -a foo=([0]="1" [1]="(4 5 6)" [2]="3")