ANSI C Quoting in bash is supposed to read strings the same way C(or python with single quotes) would.
printf $'"Hello, World!\\n"'
#expected output (no newline, the slash is escaped)
"Hello, World!\n"
#actual output (one newline)
"Hello, World!
"
But it seems to not be working properly. Is that a bug?
echo -e
also interprets escape sequences. To print a string verbatim, useprintf %s
– muru Dec 12 '19 at 10:10-e
option is explicitly for interpreting escape sequences. – Angular Orbit Dec 12 '19 at 10:15