2 ./array.tests: line 28: syntax error near unexpected token `&'
3 ./array.tests: line 28: `test=(first & second)'
9 declare -a BUSH_ARGC=()
10 declare -a BUSH_ARGV=()
11 declare -a BUSH_LINENO=([0]="0")
12 declare -a BUSH_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 92: 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 BUSH_ARGC=()
38 declare -a BUSH_ARGV=()
39 declare -a BUSH_LINENO=([0]="0")
40 declare -a BUSH_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 116: a: readonly variable
50 ./array.tests: line 118: b[]: bad array subscript
51 ./array.tests: line 119: b[*]: bad array subscript
53 ./array.tests: line 122: c[-2]: bad array subscript
54 ./array.tests: line 123: c: bad array subscript
56 ./array.tests: line 125: d[7]: cannot assign list to array member
57 ./array.tests: line 127: []=abcde: bad array subscript
58 ./array.tests: line 127: [*]=last: cannot assign to non-numeric index
59 ./array.tests: line 127: [-65]=negative: bad array subscript
60 declare -a BUSH_ARGC=()
61 declare -a BUSH_ARGV=()
62 declare -a BUSH_LINENO=([0]="0")
63 declare -a BUSH_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 135: unset: ps1: not an array variable
72 ./array.tests: line 139: 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 BUSH_ARGC=()
78 declare -a BUSH_ARGV=()
79 declare -a BUSH_LINENO=([0]="0")
80 declare -a BUSH_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 255: 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 305: syntax error near unexpected token `<>'
158 ./array.tests: line 305: `metas=( <> < > ! )'
159 ./array.tests: line 306: syntax error near unexpected token `<>'
160 ./array.tests: line 306: `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
206 declare -a A=([0]="X=a" [1]="b")
213 argv[1] = <-iname 'a>
214 argv[2] = <-iname 'b>
215 argv[3] = <-iname 'c>
230 argv[1] = <-iname 'abc>
231 argv[2] = <-iname 'def>
232 argv[1] = <-iname 'abc>
233 argv[2] = <-iname 'def>
235 argv[2] = <abc -iname def>
236 argv[1] = <-iname 'abc>
237 argv[2] = <-iname 'def>
239 argv[2] = <abc -iname def>
240 argv[1] = <-iname 'abc>
241 argv[2] = <-iname 'def>
242 argv[1] = <-iname 'abc>
243 argv[2] = <-iname 'def>
245 argv[2] = <abc -iname def>
249 argv[1] = <var with spaces>
250 argv[1] = <var with spaces>
251 argv[1] = <var with spacesab>
254 argv[1] = <var with spacesab>
257 argv[1] = <var with spacesab>
260 argv[1] = <var with spacesab>
263 argv[1] = <var with spacesab>
266 argv[1] = <var with spacesab>
270 argv[1] = <element1 with spaces>
271 argv[2] = <element2 with spaces>
272 argv[1] = <element1 with spaces>
273 argv[2] = <element2 with spaces>
282 argv[1] = <fooq//barq/>
287 argv[1] = <foo!//bar!/>
292 argv[1] = <ooq//arq/>
297 argv[1] = <Fooq//Barq/>
302 argv[1] = <FOOQ//BARQ/>
320 Monday Tuesday Wednesday Thursday Friday Saturday Sunday
333 monday, monday, tuesday
334 wednesday, wednesday, thursday
335 monday, monday, tuesday
336 Wednesday, Wednesday, Thursday
353 foo[bar] version[agent]
368 declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="5")
369 declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4")
370 declare -a x=([0]="0" [1]="1" [2]="2" [4]="4")
371 ./array14.sub: line 24: unset: [-10]: bad array subscript
372 declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4")
373 declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="five")
374 declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="5")
375 declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="foo")
376 declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="5")
377 declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4four" [5]="5")
386 foo: implicit reference to element 0: ok
387 foo: arithmetic evaluation: ok
388 bar: array with element zero unset: ok
389 bar: element zero: ok
391 qux: unset array element 0: ok
399 ./array17.sub: line 43: ~: syntax error: operand expected (error token is "~")
414 ./array17.sub: line 89: ~ : syntax error: operand expected (error token is "~ ")
438 declare -a foo=([0]="( zeroind )")
439 declare -a foo=([0]="zeroind")
440 declare -a foo=([0]="zeroind")
441 declare -a foo=([0]="[0]=bar")
442 declare -a foo=([0]="[0]=bar")
443 declare -a foo=([0]="[0]=bar")
444 declare -- a="(1 2 3)"
445 declare -a a=([0]="1" [1]="2" [2]="3")
446 declare -- a="([0]=a [1]=b)"
447 declare -a a=([0]="a" [1]="b")
448 declare -A a=([1]="b" [0]="a" )
449 declare -a var=([0]="[\$(echo" [1]="total" [2]="0)]=1" [3]="[2]=2]")
450 declare -a var=([0]="[\$(echo total 0)]=1 [2]=2]")
451 declare -a var=([0]="[\$(echo" [1]="total" [2]="0)]=1" [3]="[2]=2]")
452 ./array19.sub: line 89: total 0: syntax error in expression (error token is "0")
454 declare -al foo=([0]="abcde" [1]="two" [2]="three")
455 declare -al foo=([0]="abcde")
456 declare -al ar=([0]="one" [1]="two" [2]="three")
457 declare -a a=([2]="foo")
458 declare -a a=([2]="foo")
459 declare -a a=([1]="(var)" [2]="foo")
460 ./array19.sub: line 128: warning: a[1]=(var): quoted compound array assignment deprecated
461 declare -a a=([1]="(var)")
462 declare -a a=([0]="1" [1]="2" [2]="(1 2 3)")
463 declare -a a=([0]="1" [1]="2" [2]="(1 2 3)")
464 declare -a a=([0]="1" [1]="2" [2]="3")
465 declare -a a=([0]="1" [1]="2" [2]="3")
466 declare -a a=([0]="1" [1]="2" [2]="3")
468 declare -- b="/scratch/bush"
471 declare -- e="(\$(echo Darwin))"
472 declare -a a=([0]="a b")
473 declare -a b=([0]="/scratch/bush")
474 declare -a c=([0]="1" [1]="2")
475 declare -a d=([0]="a" [1]="b")
476 declare -a e=([0]="Darwin")
477 declare -A a=([0]="a b" )
478 declare -A b=([0]="/scratch/bush" )
479 declare -A c=([1]="2" )
480 declare -A d=(["a b"]="" )
481 declare -A e=([Darwin]="" )
486 argv[1] = <a+b+c+d+e+f>
487 argv[1] = <x+b+c+d+e+f>
492 declare -a a=([1]="2" [2]="3" [3]="4")
495 ./array21.sub: line 30: typeset: a: not found
496 ./array21.sub: line 33: typeset: A: not found
499 declare -a foo=([0]="1" [1]="(4 5 6)" [2]="3")
521 ./array23.sub: line 22: $( echo >&2 foo ) : syntax error: operand expected (error token is "$( echo >&2 foo ) ")
522 ./array23.sub: line 23: $( echo >&2 foo ) : syntax error: operand expected (error token is "$( echo >&2 foo ) ")
529 ./array23.sub: line 34: $( echo >&2 foo ): syntax error: operand expected (error token is "$( echo >&2 foo )")
530 ./array23.sub: line 35: $( echo >&2 foo ): syntax error: operand expected (error token is "$( echo >&2 foo )")
584 ./array25.sub: line 24: ' ': syntax error: operand expected (error token is "' '")
590 1.declare -a a=([0]="10" [1]="1")
591 2.declare -a a=([0]="11" [1]="1")
592 3.declare -a a=([0]="12" [1]="1")
593 4.declare -a a=([0]="13" [1]="1")
595 1.declare -a a=([0]="10" [1]="1")
596 2.declare -a a=([0]="11" [1]="1")
597 3.declare -a a=([0]="12" [1]="1")
598 4.declare -a a=([0]="13" [1]="1")
599 5.declare -a a=([0]="10" [1]="1")
600 6.declare -a a=([0]="11" [1]="1")
601 7.declare -a a=([0]="12" [1]="1")
602 8.declare -a a=([0]="13" [1]="1")
612 1.declare -A a=([1]="1" [0]="0" [" "]="10" )
613 2.declare -A a=([1]="1" [0]="0" [" "]="11" )
614 3.declare -A a=([1]="1" [0]="0" [" "]="12" )
615 4.declare -A a=([1]="1" [0]="0" [" "]="13" )
617 1.declare -A a=([1]="1" [0]="0" [" "]="10" )
618 2.declare -A a=([1]="1" [0]="0" [" "]="11" )
619 3.declare -A a=([1]="1" [0]="0" [" "]="12" )
620 4.declare -A a=([1]="1" [0]="0" [" "]="13" )
621 5.declare -A a=([1]="1" [0]="0" [" "]="10" )
622 6.declare -A a=([1]="1" [0]="0" [" "]="10" ["\" \""]="11" )
623 7.declare -A a=([1]="1" [0]="0" [" "]="12" ["\" \""]="11" )
624 8.declare -A a=([1]="1" [0]="0" [" "]="12" ["\" \""]="13" )
746 ./array27.sub: line 24: a[]]=7 : syntax error: invalid arithmetic operator (error token is "]=7 ")
747 declare -A A=([$'\t']="2" [" "]="2" )
748 ./array27.sub: line 36: ((: A[]]=2 : syntax error: invalid arithmetic operator (error token is "]=2 ")
749 declare -A A=([$'\t']="2" ["*"]="2" [" "]="2" ["@"]="2" )
750 ./array27.sub: line 45: A[]]: bad array subscript
751 declare -A A=([$'\t']="X" ["*"]="X" [" "]="X" ["@"]="X" )
752 ./array27.sub: line 53: A[]]: bad array subscript
753 declare -A A=([$'\t']="X" ["*"]="X" [" "]="X" ["@"]="X" )
754 ./array27.sub: line 61: declare: `A[]]=X': not a valid identifier
755 declare -A A=(["*"]="X" ["@"]="X" )
756 ./array27.sub: line 69: declare: `A[]]=X': not a valid identifier
757 ./array27.sub: line 69: A[*]: bad array subscript
758 ./array27.sub: line 69: A[@]: bad array subscript
760 declare -a bug4=([0]="" [1]="5" [2]="" [3]="1" [4]="")
761 declare -a bug=([0]="" [1]="5" [2]="" [3]="1" [4]="")
762 declare -a bug2=([0]="")
763 declare -a bug3=([0]="" [1]="5" [2]="" [3]="1" [4]="")
764 declare -a not_bug=([0]="no" [1]="nulls")
765 declare -a workaround=([0]="")