Use ANSI-C quoting for escapes like newline and tab.
Section: Quoting
ANSI-C quoted string
bash
bash
printf '%s
' $'line1
line2'Explanation
Bash supports $'...' expansion for escaped literals.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Quoting
Expandable double-quoted string
Double quotes allow variable and command expansion.
Escape one character
Backslash escapes the next character in many contexts.