diff --git a/SC1001.md b/SC1001.md index d50f7e8..fd31a56 100644 --- a/SC1001.md +++ b/SC1001.md @@ -6,11 +6,8 @@ # Want literal backslash echo Yay \o/ -# Want linefeed -greeting=Hello\nWorld - # Want other characters -carriagereturn=\r +bell=\a ``` ### Correct code: @@ -18,10 +15,7 @@ carriagereturn=\r ```sh echo 'Yay \o/' -greeting='Hello -World' - -carriagereturn=$(printf '\r') +bell="$(printf '\a')" ``` ### Rationale: @@ -30,7 +24,7 @@ You have escaped something that has no special meaning when escaped. The backsla If the backslash was supposed to be literal, single quote or escape it. -If you wanted it to expand to something, rewrite the expression. For linefeeds (`\n`), put them literally in quotes. For other characters, use POSIX `printf` or bash/ksh `$'...'`. +If you wanted it to expand to something, rewrite the expression to use `printf` (or in bash, `$'\t'`). If the sequence in question is `\n`, `\t` or `\r`, you instead get a [[SC1012]] that describes this. ### Exceptions