Name
echo
Synopsis
echo [-eEn] [string]Write string to standard output. (See also echo in Chapter 3.)
Options
- -e
Enable interpretation of the following escape sequences, which must be quoted (or escaped with a \) to prevent interpretation by the shell:
- \a
Alert (ASCII BEL).
- \b
Backspace.
- \c
Suppress the terminating newline (same as -n).
- \e
ASCII Escape character.
- \f
Formfeed.
- \n
Newline.
- \r
Carriage return.
- \t
Tab character.
- \v
Vertical-tab character.
- \\
Backslash.
- \0nnn
ASCII character represented by octal number nnn, where nnn is zero, one, two, or three digits and is preceded by a 0.
- \nnn
ASCII character represented by octal number nnn, where nnn is one, two, or three digits.
- \xHH
ASCII character represented by hexadecimal number HH, where HH is one or two hexadecimal digits.
- -E
Do not interpret escape sequences, even on systems where the default behavior of the built-in echo is to interpret them.
- -n
Do not print the terminating newline.
Examples
$echo "testing printer" | lp$echo "Warning: ringing bell \a"
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access