5.1.9 Escape characters
- Organization of this subsection
(1) List of escape characters
The echo and print commands interpret the characters listed in the following table as escape characters:
Escape character |
Meaning |
echo command |
print command |
---|---|---|---|
\a |
Alert character (bell) |
Y |
Y |
\b |
Backspace character |
Y |
Y |
\c |
Suppresses the linefeed character at the end of a line (characters following \c are not output) |
Y |
Y |
\f |
Formfeed character (page break) |
Y |
Y |
\n |
Linefeed character |
Y |
Y |
\r |
Carriage return character |
Y |
Y |
\t |
Tab character |
Y |
Y |
\v |
Vertical tab character |
Y |
Y |
\0nnn#1 |
ASCII character represented by one, two, or three octal digits (0 to 7) |
Y |
Y |
\xnn#2 |
ASCII character represented by one or two hexadecimal digits (0 to 9, a to f, A to F) |
Y |
N |
\\ |
A single backslash character |
Y |
Y |
(2) Handling of the echo command with neither -e nor -E option specified
If neither the -e option (interprets escape characters) nor the -E option (does not interpret escape characters) is specified in the echo command, the handling of escape characters depends on the setting in the ESCAPE_SEQ_ECHO_DEFAULT environment parameter. For details about the ESCAPE_SEQ_ECHO_DEFAULT environment parameter, see ESCAPE_SEQ_ECHO_DEFAULT parameter (defines the action of the echo command when the escape-character option is omitted) in 7. Parameters Specified in the Environment Files.