From 4c193fb2bbdde7eac917c08ead83e7a77ba1b4d0 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Tue, 29 Jul 2025 20:46:25 +0900 Subject: [PATCH] Updated SC2124 (markdown) --- SC2124.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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