escape sequence

A backslash followed by a character that together stand for something hard to type directly, such as \n for a line break.

In more detail

Escape sequences let text contain characters such as line breaks, tabs or quote marks that would otherwise end or break the text. Common ones are \n for a newline, \t for a tab and \\ for a real backslash. Which sequences are understood depends on the language, tool and quoting, so the same text can print differently in different places.

Examples

content: "enabled\n" in a copy task writes a file ending in a real line break.
printf 'one\ttwo\n'
echo $'tab:\there'
route="/say \"hi\""
Prometheus label values must escape " \ and newline.
print("one\ntwo")

Related terms

Taught in

References

Certification courses