Updated SC2124 (markdown)

Vidar Holen
2020-11-19 13:27:34 -08:00
parent a0e64db161
commit b17d618d9f

@@ -48,7 +48,7 @@ Since doing this usually indicates a bug, ShellCheck warns and asks you to be ex
If you want to assign N elements as N elements in Bash or Ksh, use an array, e.g. `myArray=( "$@" )`. If you want to assign N elements as N elements in Bash or Ksh, use an array, e.g. `myArray=( "$@" )`.
Dash and POSIX sh do not support arrays. In this case, either concatenate the values with some delimiter that you can split on later (the example uses linefeeds and splits them back up with a `while read` loop), or keep the values as positional parameters without putting them in an array. Dash and POSIX sh do not support arrays. In this case, either concatenate the values with some delimiter that you can split on later (the example uses linefeeds and splits them back up with a `while read` loop), or keep the values as positional parameters without putting them in an intermediate variable.
If you want to assign N elements as 1 element by concatenating them, use `*` instead of `@`, e.g. `myVar=${myArray[*]}` (this separates elements with the first character of `IFS`, usually space). If you want to assign N elements as 1 element by concatenating them, use `*` instead of `@`, e.g. `myVar=${myArray[*]}` (this separates elements with the first character of `IFS`, usually space).