mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated SC2124 (markdown)
@@ -59,12 +59,15 @@ The same is true for `${@: -1}`, which results in 0 or 1 elements: `var=${*: -1}
|
||||
None.
|
||||
|
||||
### Adding an element to an array may trigger this warning when you forget the parenthesis.
|
||||
```
|
||||
```sh
|
||||
filelist="${filelist[@]}" "$filename"
|
||||
```
|
||||
|
||||
What was meant is:
|
||||
```
|
||||
|
||||
```sh
|
||||
filelist=("${filelist[@]}" "$filename")
|
||||
```
|
||||
|
||||
Note: This syntax is compatible with older shells;
|
||||
in later shells (bash 3.1+ and zsh 4.2+), you can do `filelist+=("$filename")`.
|
||||
in later shells (bash 3.1+ and zsh 4.2+), you can do `filelist+=("$filename")`.
|
Reference in New Issue
Block a user