diff --git a/SC2124.md b/SC2124.md index 183a94f..76534cb 100644 --- a/SC2124.md +++ b/SC2124.md @@ -50,3 +50,13 @@ The same is true for `${@: -1}`, which results in 0 or 1 elements: `var=${*: -1} ### Exceptions None. + +### Adding an element to an array may trigger this warning when you forget the parenthesis. +``` +filelist="${filelist[@]}" "$filename" +``` +What was meant is: +``` +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")```