53a7a006183eeff9d7d3e81d5e2c81111ba672d3
[platform/upstream/bash.git] / tests / array.right
1
2 ./array.tests: line 15: syntax error near unexpected token `&'
3 ./array.tests: line 15: `test=(first & second)'
4 1
5 abcde
6 abcde
7 abcde bdef
8 abcde bdef
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='()'
14 declare -a FUNCNAME='([0]="main")'
15 declare -a a='([0]="abcde" [1]="" [2]="bdef")'
16 declare -a b='()'
17 declare -ar c='()'
18 abcde bdef
19 abcde bdef
20 abcde
21 abcde
22 abcde
23
24 bdef
25 hello world
26 11
27 3
28 bdef hello world test expression
29 ./array.tests: line 74: readonly: `a[5]': not a valid identifier
30 declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
31 declare -ar c='()'
32 declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
33 declare -ar c='()'
34 readonly -a a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
35 readonly -a c='()'
36 a test
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='()'
42 declare -a FUNCNAME='([0]="main")'
43 declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
44 declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
45 declare -ar c='()'
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 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
55
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
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='()'
65 declare -a FUNCNAME='([0]="main")'
66 declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
67 declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
68 declare -ar c='()'
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 117: unset: ps1: not an array variable
72 ./array.tests: line 121: declare: c: cannot destroy array variables in this way
73 this of
74 this is a test of read using arrays
75 this test
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='()'
82 declare -a FUNCNAME='([0]="main")'
83 declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
84 declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
85 declare -ar c='()'
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")'
89 abde
90 abde
91 bbb
92 efgh
93 wxyz
94 wxyz
95 ./array.tests
96 a
97 b c
98 d
99 e f g
100 h
101 ./array.tests
102 a
103 b c
104 d
105 e f g
106 h
107 /bin /usr/bin /usr/ucb /usr/local/bin . /sbin /usr/sbin
108 bin bin ucb bin . sbin sbin
109 bin
110 / / / / / /
111 /
112 argv[1] = <bin>
113 argv[1] = </>
114 argv[1] = <sbin>
115 argv[1] = </>
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
119 4 -- 4
120 7 -- 7
121 55
122 49
123 6 -- 6
124 42 14 44
125 grep [ 123 ] *
126 6 7 9
127 6 7 9 5
128 length = 3
129 value = new1 new2 new3
130 ./array.tests: line 237: 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: syntax error near unexpected token `('
134 ./array2.sub: line 1: `declare -a ''=(a 'b c')'
135 9
136 9
137
138
139 7 8 9
140 8 11
141 8 11
142 6
143 6
144 nordholz
145 8
146 8
147 8
148
149 a b c d e f g
150 for case if then else
151 <> < > !
152 12 14 16 18 20
153 4414758999202
154 aaa bbb
155 ./array.tests: line 285: syntax error near unexpected token `<>'
156 ./array.tests: line 285: `metas=( <> < > ! )'
157 ./array.tests: line 286: syntax error near unexpected token `<>'
158 ./array.tests: line 286: `metas=( [1]=<> [2]=< [3]=> [4]=! )'
159 abc 3
160 case 4
161 abc case if then else 5
162 abc case if then else 5
163 0
164 case 4
165 case if then else 5
166 case if then else 5
167 argv[1] = <0>
168 argv[2] = <1>
169 argv[3] = <4>
170 argv[4] = <10>
171 argv[1] = <0>
172 argv[2] = <1>
173 argv[3] = <4>
174 argv[4] = <10>
175 argv[1] = <0>
176 argv[2] = <1>
177 argv[3] = <4>
178 argv[4] = <10>
179 argv[1] = <0 1 4 10>
180 include null element -- expect one
181 one
182 include unset element -- expect three five
183 three five
184 start at unset element -- expect five seven
185 five seven
186 too many elements -- expect three five seven
187 three five seven
188 positive offset - expect five seven
189 five seven
190 negative offset to unset element - expect seven
191 seven
192 positive offset 2 - expect seven
193 seven
194 negative offset 2 - expect seven
195 seven
196 out-of-range offset
197
198 e
199 4
200 1 4 7 10
201 'b
202 b  c
203 $0
204 t
205 [3]=abcde r s t u v
206 e
207 9
208 2