e142fdbc63a66c1cbaae51f51bb28103d0c7c6f4
[platform/upstream/bash.git] / tests / array.right
1 abcde
2 abcde
3 abcde bdef
4 abcde bdef
5 declare -a DIRSTACK='()'
6 declare -a a='([0]="abcde" [1]="" [2]="bdef")'
7 declare -a b='()'
8 declare -ar c='()'
9 abcde bdef
10 abcde bdef
11 abcde
12 abcde
13 abcde
14
15 bdef
16 hello world
17 11
18 3
19 bdef hello world test expression
20 ./array.tests: readonly: `a[5]': not a valid identifier
21 declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
22 declare -ar c='()'
23 declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
24 declare -ar c='()'
25 ./array.tests: declare: e: cannot assign to array variables in this way
26 a test
27 declare -a DIRSTACK='()'
28 declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
29 declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
30 declare -ar c='()'
31 declare -a d='([1]="" [2]="bdef" [5]="hello world" [6]="test" [9]="ninth element")'
32 declare -a e='([0]="test")'
33 declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")'
34 ./array.tests: a: readonly variable
35 ./array.tests: b[]: bad array subscript
36 ./array.tests: b[*]: bad array subscript
37 ./array.tests: ${b[   ]}: bad substitution
38 ./array.tests: c[-2]: bad array subscript
39 ./array.tests: c: bad array subscript
40
41 ./array.tests: d[7]: cannot assign list to array member
42 ./array.tests: []=abcde: bad array subscript
43 ./array.tests: [*]=last: cannot assign to non-numeric index
44 ./array.tests: [-65]=negative: bad array subscript
45 declare -a DIRSTACK='()'
46 declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
47 declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
48 declare -ar c='()'
49 declare -a d='([1]="test test" [2]="bdef" [5]="hello world" [6]="test" [9]="ninth element")'
50 declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")'
51 ./array.tests: unset: ps1: not an array variable
52 ./array.tests: declare: c: cannot destroy array variables in this way
53 this of
54 this is a test of read using arrays
55 declare -a DIRSTACK='()'
56 declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
57 declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
58 declare -ar c='()'
59 declare -a d='([1]="test test" [2]="bdef" [5]="hello world" [6]="test" [9]="ninth element")'
60 declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")'
61 declare -a rv='([0]="this" [1]="is" [2]="a" [3]="test" [4]="of" [5]="read" [6]="using" [7]="arrays")'
62 abde
63 abde
64 bbb
65 efgh
66 wxyz
67 wxyz
68 ./array.tests
69 a
70 b c
71 d
72 e f g
73 h
74 ./array.tests
75 a
76 b c
77 d
78 e f g
79 h
80 /bin /usr/bin /usr/ucb /usr/local/bin . /sbin /usr/sbin
81 bin bin ucb bin . sbin sbin
82 bin
83 / / / / / /
84 /
85 \bin \usr/bin \usr/ucb \usr/local/bin . \sbin \usr/sbin
86 \bin \usr\bin \usr\ucb \usr\local\bin . \sbin \usr\sbin
87 \bin \usr\bin \usr\ucb \usr\local\bin . \sbin \usr\sbin
88 4 -- 4
89 7 -- 7
90 55
91 49
92 6 -- 6
93 42 14 44
94 grep [ 123 ] *
95 6 7 9
96 6 7 9 5
97 ./array.tests: narray: unbound variable