Imported from ../bash-3.0.16.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
132 a b c d e f g
133 for case if then else
134 <> < > !
135 12 14 16 18 20
136 4414758999202
137 aaa bbb
138 ./array.tests: line 277: syntax error near unexpected token `<>'
139 ./array.tests: line 277: `metas=( <> < > ! )'
140 ./array.tests: line 278: syntax error near unexpected token `<>'
141 ./array.tests: line 278: `metas=( [1]=<> [2]=< [3]=> [4]=! )'
142 abc 3
143 case 4
144 abc case if then else 5
145 abc case if then else 5
146 0
147 case 4
148 case if then else 5
149 case if then else 5
150 argv[1] = <0>
151 argv[2] = <1>
152 argv[3] = <4>
153 argv[4] = <10>
154 argv[1] = <0>
155 argv[2] = <1>
156 argv[3] = <4>
157 argv[4] = <10>
158 argv[1] = <0>
159 argv[2] = <1>
160 argv[3] = <4>
161 argv[4] = <10>
162 argv[1] = <0 1 4 10>
163 include null element -- expect one
164 one
165 include unset element -- expect three five
166 three five
167 start at unset element -- expect five seven
168 five seven
169 too many elements -- expect three five seven
170 three five seven
171 positive offset - expect five seven
172 five seven
173 negative offset to unset element - expect seven
174 seven
175 positive offset 2 - expect seven
176 seven
177 negative offset 2 - expect seven
178 seven
179 out-of-range offset
180