]> git.ipfire.org Git - thirdparty/bash.git/blob - tests/array.right
Imported from ../bash-2.0.tar.gz.
[thirdparty/bash.git] / tests / array.right
1 abcde
2 abcde bdef
3 abcde bdef
4 declare -a DIRSTACK='()'
5 declare -a a='([0]="abcde" [1]="" [2]="bdef")'
6 declare -a b='()'
7 declare -ar c='()'
8 abcde bdef
9 abcde bdef
10 abcde
11 abcde
12 abcde
13
14 bdef
15 hello world
16 11
17 3
18 bdef hello world test expression
19 ./array.tests: readonly: `a[5]': not a valid identifier
20 declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
21 declare -ar c='()'
22 declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
23 declare -ar c='()'
24 ./array.tests: declare: e: cannot assign to array variables in this way
25 a test
26 declare -a DIRSTACK='()'
27 declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
28 declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
29 declare -ar c='()'
30 declare -a d='([1]="" [2]="bdef" [5]="hello world" [6]="test" [9]="ninth element")'
31 declare -a e='([0]="test")'
32 declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")'
33 ./array.tests: a: readonly variable
34 ./array.tests: b[]: bad array subscript
35 ./array.tests: b[*]: bad array subscript
36 ./array.tests: ${b[ ]}: bad substitution
37 ./array.tests: c[-2]: bad array subscript
38 ./array.tests: c: bad array subscript
39
40 ./array.tests: d[7]: cannot assign list to array member
41 ./array.tests: []=abcde: bad array subscript
42 ./array.tests: [*]=last: cannot assign to non-numeric index
43 ./array.tests: [-65]=negative: bad array subscript
44 declare -a DIRSTACK='()'
45 declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
46 declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
47 declare -ar c='()'
48 declare -a d='([1]="test test" [2]="bdef" [5]="hello world" [6]="test" [9]="ninth element")'
49 declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")'
50 ./array.tests: unset: ps1: not an array variable
51 ./array.tests: declare: c: cannot destroy array variables in this way
52 this of
53 this is a test of read using arrays
54 declare -a DIRSTACK='()'
55 declare -a rv='([0]="this" [1]="is" [2]="a" [3]="test" [4]="of" [5]="read" [6]="using" [7]="arrays")'
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 abde
62 abde
63 bbb
64 efgh
65 wxyz
66 wxyz
67 ./array.tests
68 a
69 b c
70 d
71 e f g
72 h
73 ./array.tests
74 a
75 b c
76 d
77 e f g
78 h