Updated SC2124 (markdown)

Eisuke Kawashima
2025-07-29 20:46:25 +09:00
parent d2292fdc1e
commit 4c193fb2bb

@@ -59,12 +59,15 @@ The same is true for `${@: -1}`, which results in 0 or 1 elements: `var=${*: -1}
None. None.
### Adding an element to an array may trigger this warning when you forget the parenthesis. ### Adding an element to an array may trigger this warning when you forget the parenthesis.
``` ```sh
filelist="${filelist[@]}" "$filename" filelist="${filelist[@]}" "$filename"
``` ```
What was meant is: What was meant is:
```
```sh
filelist=("${filelist[@]}" "$filename") filelist=("${filelist[@]}" "$filename")
``` ```
Note: This syntax is compatible with older shells; 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")`.