diff --git a/SC2086.md b/SC2086.md index 7a6790b..a9634e7 100644 --- a/SC2086.md +++ b/SC2086.md @@ -1,6 +1,6 @@ -#Double quote to prevent globbing and word splitting. +# Double quote to prevent globbing and word splitting. -### Problematic code: +## Problematic code: ```sh echo $1 @@ -8,13 +8,13 @@ for i in $*; do :; done # this one and the next one also applies to expanding ar for i in $@; do :; done ``` -### Correct code: +## Correct code: ```sh echo "$1" for i in "$@"; do :; done # or, 'for i; do' ``` -### Rationale +## Rationale The first code looks like "print the first argument". It's actually "Split the first argument by IFS (spaces, tabs and line feeds). Expand each of them as if it was a glob. Join all the resulting strings and filenames with spaces. Print the result."