echo(1)


echo -- echo arguments

Synopsis

/usr/bin/echo [ -n ] [arg] . . .
echo [arg] . . .

Description

The echo command is useful for producing diagnostics in command files, for sending known data into a pipe, and for displaying the contents of environment variables. The command writes its arguments, separated by blanks and terminated by a new-line, on the standard output.

The first synopsis describes the traditional echo builtin command for sh(1) ksh88(1) and other legacy shells, as well as the /usr/bin/echo standalone command. The -n option is used when the termination by a new-line is not wanted. The -n option is a transition aid for legacy applications, and will be removed in a future release.

The second synopsis describes the echo builtin command for the system's standard shell, ksh(1) (ksh-93). This version is standards-compliant and as such does not support the -n option.

The other capabilities of echo described here are the same between both versions.

echo understands the following C-like escape conventions (beware of conflicts with the shell's use of the backslash character):


\a
alert

\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 1-, 2-, or 3-digit octal encoding of an 8-bit character. Each byte of multibyte characters should be preceded by backslash (\).
The echo command processes supplementary code set characters according to the locale specified in the LC_CTYPE environment variable (see LANG on environ(5)).

References

csh(1), sh(1)

Notices

When representing an 8-bit character by using the escape convention \0n, the n must be preceded by the digit zero (0).

For example, typing: echo ´WARNING:\07´ displays the phrase WARNING: and sounds the bell on your terminal. The use of single (or double) quotes (or two backslashes) is required to protect the ``\'' that precedes the ``07''.

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)

 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)

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004