diff --git a/SC2124.md b/SC2124.md index ed0813e..68f2b97 100644 --- a/SC2124.md +++ b/SC2124.md @@ -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")`. \ No newline at end of file