Updated SC1001 (markdown)

Vidar Holen
2018-06-23 22:53:27 -07:00
parent e01fbca038
commit 4e5ab8ab04

@@ -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