manpagez: man pages & more
info coreutils
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

15.1 echo: Print a line of text

echo writes each given string to standard output, with a space between each and a newline after the last one. Synopsis:

 
echo [option]… [string]…

The program accepts the following options. Also see Common options. Options must precede operands, and the normally-special argument ‘--’ has no special meaning and is treated like any other string.

-n

Do not output the trailing newline.

-e

Enable interpretation of the following backslash-escaped characters in each string:

\a

alert (bell)

\b

backspace

\c

suppress trailing newline

\f

form feed

\n

new line

\r

carriage return

\t

horizontal tab

\v

vertical tab

\\

backslash

\0nnn

the eight-bit value that is the octal number nnn (zero to three octal digits)

\nnn

the eight-bit value that is the octal number nnn (one to three octal digits)

\xhh

the eight-bit value that is the hexadecimal number hh (one or two hexadecimal digits)

-E

Disable interpretation of backslash escapes in each string. This is the default. If ‘-e’ and ‘-E’ are both specified, the last one given takes effect.

If the POSIXLY_CORRECT environment variable is set, then when echo's first argument is not ‘-n’ it outputs option-like arguments instead of treating them as options. For example, echo -ne hello outputs ‘-ne hello’ instead of plain ‘hello’.

POSIX does not require support for any options, and says that the behavior of echo is implementation-defined if any string contains a backslash or if the first argument is ‘-n’. Portable programs can use the printf command if they need to omit trailing newlines or output control characters or backslashes. See section printf: Format and print data.

An exit status of zero indicates success, and a nonzero value indicates failure.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2017
Individual documents may contain additional copyright information.