b337656180a68cc428a36f7993eae94f00ab38e2
[platform/upstream/bash.git] / tests / array.right
1 ./array.tests: array assign: line 10: syntax error near unexpected token `&'
2 ./array.tests: array assign: line 10: `first & second'
3 1
4 abcde
5 abcde
6 abcde bdef
7 abcde bdef
8 declare -a DIRSTACK='()'
9 declare -a a='([0]="abcde" [1]="" [2]="bdef")'
10 declare -a b='()'
11 declare -ar c='()'
12 abcde bdef
13 abcde bdef
14 abcde
15 abcde
16 abcde
17
18 bdef
19 hello world
20 11
21 3
22 bdef hello world test expression
23 ./array.tests: readonly: `a[5]': not a valid identifier
24 declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
25 declare -ar c='()'
26 declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
27 declare -ar c='()'
28 readonly -a a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
29 readonly -a c='()'
30 a test
31 declare -a DIRSTACK='()'
32 declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
33 declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
34 declare -ar c='()'
35 declare -a d='([1]="" [2]="bdef" [5]="hello world" [6]="test" [9]="ninth element")'
36 declare -a e='([0]="test")'
37 declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")'
38 ./array.tests: a: readonly variable
39 ./array.tests: b[]: bad array subscript
40 ./array.tests: b[*]: bad array subscript
41 ./array.tests: ${b[   ]}: bad substitution
42 ./array.tests: c[-2]: bad array subscript
43 ./array.tests: c: bad array subscript
44
45 ./array.tests: d[7]: cannot assign list to array member
46 ./array.tests: []=abcde: bad array subscript
47 ./array.tests: [*]=last: cannot assign to non-numeric index
48 ./array.tests: [-65]=negative: bad array subscript
49 declare -a DIRSTACK='()'
50 declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
51 declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
52 declare -ar c='()'
53 declare -a d='([1]="test test")'
54 declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")'
55 ./array.tests: unset: ps1: not an array variable
56 ./array.tests: declare: c: cannot destroy array variables in this way
57 this of
58 this is a test of read using arrays
59 this test
60 this is a test of arrays
61 declare -a DIRSTACK='()'
62 declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
63 declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
64 declare -ar c='()'
65 declare -a d='([1]="test test")'
66 declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")'
67 declare -a rv='([0]="this" [1]="is" [2]="a" [3]="test" [4]="of" [5]="read" [6]="using" [7]="arrays")'
68 abde
69 abde
70 bbb
71 efgh
72 wxyz
73 wxyz
74 ./array.tests
75 a
76 b c
77 d
78 e f g
79 h
80 ./array.tests
81 a
82 b c
83 d
84 e f g
85 h
86 /bin /usr/bin /usr/ucb /usr/local/bin . /sbin /usr/sbin
87 bin bin ucb bin . sbin sbin
88 bin
89 / / / / / /
90 /
91 \bin \usr/bin \usr/ucb \usr/local/bin . \sbin \usr/sbin
92 \bin \usr\bin \usr\ucb \usr\local\bin . \sbin \usr\sbin
93 \bin \usr\bin \usr\ucb \usr\local\bin . \sbin \usr\sbin
94 4 -- 4
95 7 -- 7
96 55
97 49
98 6 -- 6
99 42 14 44
100 grep [ 123 ] *
101 6 7 9
102 6 7 9 5
103 length = 3
104 value = new1 new2 new3
105 ./array.tests: narray: unbound variable
106
107 a b c d e f g
108 for case if then else
109 <> < > !
110 12 14 16 18 20
111 4414758999202
112 aaa bbb
113 ./array.tests: array assign: line 263: syntax error near unexpected token `for'
114 ./array.tests: array assign: line 263: `a b c for case if then else'
115 ./array.tests: array assign: line 265: syntax error near unexpected token `for'
116 ./array.tests: array assign: line 265: `for case if then else'
117 ./array.tests: array assign: line 267: syntax error near unexpected token `<>'
118 ./array.tests: array assign: line 267: ` <> < > ! '
119 ./array.tests: array assign: line 268: syntax error near unexpected token `[1]=<>'
120 ./array.tests: array assign: line 268: ` [1]=<> [2]=< [3]=> [4]=! '
121 abc 3
122 0
123 abc 1
124 abc 1
125 0
126 0
127 1
128 1