]>
Commit | Line | Data |
---|---|---|
7117c2d2 JA |
1 | |
2 | ./array.tests: line 15: syntax error near unexpected token `&' | |
3 | ./array.tests: line 15: `test=(first & second)' | |
bb70624e | 4 | 1 |
ccc6cda3 | 5 | abcde |
d166f048 | 6 | abcde |
ccc6cda3 JA |
7 | abcde bdef |
8 | abcde bdef | |
b80f6443 JA |
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")' | |
ccc6cda3 | 13 | declare -a DIRSTACK='()' |
b80f6443 | 14 | declare -a FUNCNAME='([0]="main")' |
ccc6cda3 JA |
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 | |
7117c2d2 | 29 | ./array.tests: line 74: readonly: `a[5]': not a valid identifier |
ccc6cda3 JA |
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='()' | |
cce855bc JA |
34 | readonly -a a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")' |
35 | readonly -a c='()' | |
ccc6cda3 | 36 | a test |
b80f6443 JA |
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")' | |
ccc6cda3 | 41 | declare -a DIRSTACK='()' |
b80f6443 | 42 | declare -a FUNCNAME='([0]="main")' |
ccc6cda3 JA |
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")' | |
7117c2d2 JA |
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 | |
ccc6cda3 | 55 | |
7117c2d2 JA |
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 | |
b80f6443 JA |
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")' | |
ccc6cda3 | 64 | declare -a DIRSTACK='()' |
b80f6443 | 65 | declare -a FUNCNAME='([0]="main")' |
ccc6cda3 JA |
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='()' | |
e8ce775d | 69 | declare -a d='([1]="test test")' |
ccc6cda3 | 70 | declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")' |
7117c2d2 JA |
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 | |
ccc6cda3 JA |
73 | this of |
74 | this is a test of read using arrays | |
cce855bc JA |
75 | this test |
76 | this is a test of arrays | |
b80f6443 JA |
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")' | |
ccc6cda3 | 81 | declare -a DIRSTACK='()' |
b80f6443 | 82 | declare -a FUNCNAME='([0]="main")' |
ccc6cda3 JA |
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='()' | |
e8ce775d | 86 | declare -a d='([1]="test test")' |
ccc6cda3 | 87 | declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")' |
d166f048 | 88 | declare -a rv='([0]="this" [1]="is" [2]="a" [3]="test" [4]="of" [5]="read" [6]="using" [7]="arrays")' |
ccc6cda3 JA |
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 | |
d166f048 JA |
107 | /bin /usr/bin /usr/ucb /usr/local/bin . /sbin /usr/sbin |
108 | bin bin ucb bin . sbin sbin | |
109 | bin | |
110 | / / / / / / | |
111 | / | |
7117c2d2 JA |
112 | argv[1] = <bin> |
113 | argv[1] = </> | |
114 | argv[1] = <sbin> | |
115 | argv[1] = </> | |
d166f048 JA |
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 | |
cce855bc JA |
128 | length = 3 |
129 | value = new1 new2 new3 | |
7117c2d2 | 130 | ./array.tests: line 237: narray: unbound variable |
95732b49 JA |
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 | |
bb70624e JA |
140 | |
141 | a b c d e f g | |
142 | for case if then else | |
143 | <> < > ! | |
144 | 12 14 16 18 20 | |
145 | 4414758999202 | |
28ef6c31 | 146 | aaa bbb |
95732b49 JA |
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]=! )' | |
28ef6c31 | 151 | abc 3 |
7117c2d2 JA |
152 | case 4 |
153 | abc case if then else 5 | |
154 | abc case if then else 5 | |
28ef6c31 | 155 | 0 |
7117c2d2 JA |
156 | case 4 |
157 | case if then else 5 | |
158 | case if then else 5 | |
b80f6443 JA |
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 | |
eb873671 JA |
182 | negative offset to unset element - expect seven |
183 | seven | |
b80f6443 JA |
184 | positive offset 2 - expect seven |
185 | seven | |
186 | negative offset 2 - expect seven | |
187 | seven | |
188 | out-of-range offset | |
189 | ||
95732b49 JA |
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 |