-
Notifications
You must be signed in to change notification settings - Fork 1.8k
SC1117
koalaman edited this page Jul 4, 2017
·
4 revisions
printf "%s\n" "Hello"
printf "%s\\n" "Hello"
or alternatively, with single quotes:
printf '%s\n' "Hello"
In a double quoted string, you have escaped a character that has no special behavior when escaped. Instead, it's invoking the fallback behavior of being interpreted literally.
Instead of relying on this implicit fallback, you should escape the backslash explicitly. This makes it clear that it's meant to be passed as a literal backslash in the string parameter.
None. This is a stylistic issue which can be ignored.
Before you do -- can you name the 4 characters that are special when escaped in double quotes?