Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/array.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ $ echo ${#a[100]}
$ arr=([5]=a [9]=b [23]=c)
$ echo ${!arr[@]}
5 9 23
$ echo ${!arr[@*]}
$ echo ${!arr[*]}
5 9 23
```

Expand Down
2 changes: 2 additions & 0 deletions docs/variable.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ $ echo $result
60
```


上面例子中,如果变量`result`不声明为整数,`val1*val2`会被当作字面量,不会进行整数运算。另外,`val1`和`val2`其实不需要声明为整数,因为只要`resule`声明为整数,它的赋值就会自动解释为整数运算。

注意,一个变量声明为整数以后,依然可以被改写为字符串。
Expand All @@ -394,6 +395,7 @@ foo

上面例子中,变量`foo`声明为整数,但是覆盖以后,就变成了字符串,Bash 不会报错。


**(2)`-x`参数**

`-x`参数等同于`export`命令,可以输出一个变量为子 Shell 的环境变量。
Expand Down