Skip to content

Commit 7b22e5f

Browse files
committed
docs(array): edit text
1 parent 0e971ae commit 7b22e5f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/array.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ $ mp3s=( *.mp3 )
6868
$ declare -a ARRAYNAME
6969
```
7070

71-
`read -a`命令则是将用户的命令行输入,读入一个数组
71+
`read -a`命令则是将用户的命令行输入,存入一个数组
7272

7373
```bash
7474
$ read -a dice
7575
```
7676

77-
上面命令将用户的命令行输入,读入数组`dice`
77+
上面命令将用户的命令行输入,存入数组`dice`
7878

7979
## 读取数组
8080

@@ -136,7 +136,7 @@ Activity: rafting
136136
Activity: surfing
137137
```
138138

139-
上面的例子中,数组`activities`实际包含5个元素,但是`for...in`循环直接遍历`${activities[@]}`会导致返回7个结果。为了避免这种情况,一般把`${activities[@]}`放在双引号之中。
139+
上面的例子中,数组`activities`实际包含5个成员,但是`for...in`循环直接遍历`${activities[@]}`导致返回7个结果。为了避免这种情况,一般把`${activities[@]}`放在双引号之中。
140140

141141
```bash
142142
$ for act in "${activities[@]}"; \
@@ -170,7 +170,7 @@ Activity: rafting
170170
Activity: surfing
171171
```
172172

173-
`${activities[*]}`放在双引号之中,所有元素就会变成单个字符串返回
173+
`${activities[*]}`放在双引号之中,所有成员就会变成单个字符串返回
174174

175175
```bash
176176
$ for act in "${activities[*]}"; \
@@ -397,7 +397,7 @@ colors["green"]="#00ff00"
397397
colors["blue"]="#0000ff"
398398
```
399399
400-
整数索引的数组,可以直接使用变量名创建数组,关联数组则必须用带有`-A`选项的`declare`命令声明创建。
400+
关联数组必须用带有`-A`选项的`declare`命令声明创建。相比之下,整数索引的数组,可以直接使用变量名创建数组,关联数组就不行
401401
402402
访问关联数组成员的方式,几乎与整数索引数组相同。
403403

0 commit comments

Comments
 (0)