Imported from ../bash-3.1.tar.gz.
[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
141 a b c d e f g
142 for case if then else
143 <> < > !
144 12 14 16 18 20
145 4414758999202
146 aaa bbb
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]=! )'
151 abc 3
152 case 4
153 abc case if then else 5
154 abc case if then else 5
155 0
156 case 4
157 case if then else 5
158 case if then else 5
159 argv[1] = <0>
160 argv[2] = <1>
161 argv[3] = <4>
162 argv[4] = <10>
163 argv[1] = <0>
164 argv[2] = <1>
165 argv[3] = <4>
166 argv[4] = <10>
167 argv[1] = <0>
168 argv[2] = <1>
169 argv[3] = <4>
170 argv[4] = <10>
171 argv[1] = <0 1 4 10>
172 include null element -- expect one
173 one
174 include unset element -- expect three five
175 three five
176 start at unset element -- expect five seven
177 five seven
178 too many elements -- expect three five seven
179 three five seven
180 positive offset - expect five seven
181 five seven
182 negative offset to unset element - expect seven
183 seven
184 positive offset 2 - expect seven
185 seven
186 negative offset 2 - expect seven
187 seven
188 out-of-range offset
189
190 e
191 4
192 1 4 7 10
193 'b
194 b  c
195 $0
196 t
197 [3]=abcde r s t u v
198 e
199 9