echo(1) (Essential Utilities) echo(1)
NAME
echo - echo arguments
SYNOPSIS
echo [ arg ] ...
echo [ -n ] [ arg ]
DESCRIPTION
echo writes its arguments separated by blanks and terminated by a
new-line on the standard output.
The /usr/bin/sh version understands the following C-like escape
conventions; beware of conflicts with the shell's use of \:
\b backspace
\c print line without new-line
\f form-feed
\n new-line
\r carriage return
\t tab
\v vertical tab
\\ backslash
\0n where n is the 8-bit character whose ASCII code is the
1-, 2- or 3-digit octal number representing that
character.
The following option is available to /usr/bin/sh users only if
/usr/ucb precedes /usr/bin in the user's PATH. It is available to
/usr/csh users, regardless of PATH:
-n Do not add the newline to the output.
echo is useful for producing diagnostics in command files, for
sending known data into a pipe, and for displaying the contents of
environment variables.
SEE ALSO
sh(1).
NOTES
The -n option is a transition aid for BSD applications, and may not
be supported in future releases.
When representing an 8-bit character by using the escape convention
\0n, the n must always be preceded by the digit zero (0).
For example, typing: echo 'WARNING:\07' will print the phrase
WARNING: and sound the ``bell'' on your terminal. The use of single
(or double) quotes (or two backslashes) is required to protect the
``\'' that precedes the ``07''.
7/91 Page 1
echo(1) (Essential Utilities) echo(1)
Following the \0, up to three digits are used in constructing the
octal output character. If, following the \0n, you want to echo
additional digits that are not part of the octal representation, you
must use the full 3-digit n. For example, if you want to echo ``ESC
7'' you must use the three digits ``033'' rather than just the two
digits ``33'' after the \0.
2 digits Incorrect: echo "\0337" | od -xc
produces: df0a (hex)
337 (ascii)
3 digits Correct: echo "\00337" | od -xc
produces: lb37 0a00 (hex)
033 7 (ascii)
For the octal equivalents of each character, see ascii(5), in the
Programmer's Reference Manual.
Page 2 7/91