Updated SC1003 (markdown)

koalaman
2016-12-28 21:51:22 -08:00
parent 13f9aa0bff
commit 183eac7526

@@ -1,17 +1,15 @@
Are you trying to escape that single quote? `echo 'You'\''re doing it wrong'`.
==============================================================================
## "Want to escape a single quote? echo 'This is how it'\''s done'.
### Problematic code:
```sh
echo 'You\'re doing it wrong' # unclosed single quote
echo 'This is not how it\'s done'.
```
### Correct code:
```sh
echo 'You'\''re doing it wrong'
echo $'You\'re doing it wrong' # ksh/bash/zsh "c-style" quote
echo 'This is how it'\''s done'.
```
### Rationale
@@ -22,3 +20,5 @@ In POSIX shell, the shell cares about nothing but another single quote to termin
> Enclosing characters in single-quotes ( `''` ) shall preserve the literal value of each character within the single-quotes. A single-quote cannot occur within single-quotes.
### Exceptions
If you want your single quoted string to end in a backslash, you can rewrite as `'string'\\` or [[ignore]] this warning.