NAME
echo — write
arguments to standard output
SYNOPSIS
echo |
[string ...] |
DESCRIPTION
The echo utility will write its arguments
to standard output, followed by a newline character. If there are no
arguments, only the newline character will be written.
OPTIONS
The echo utility will not recognise the --
argument in the manner specified by Guideline 10 of the XBD specification,
Utility
Syntax Guidelines ; -- will be recognised as a string operand.
Implementations will not support any options.
OPERANDS
The following operands are supported:
- string
- A string to be written to standard output. If any operand is -n, it will
be treated as a string, not an option. The following character sequences
will be recognised within any of the arguments:
- \a
- Write an alert character.
- \b
- Write a backspace character.
- \c
- Suppress the newline character that otherwise follows the final argument in the output. All characters following the \c in the arguments will be ignored.
- \f
- Write a form-feed character.
- \n
- Write a newline character.
- \r
- Write a carriage-return character.
- \t
- Write a tab character.
- \v
- Write a vertical-tab character.
- \\
- Write a backslash character.
- \0num
- Write an 8-bit value that is the zero-, one-, two- or three-digit octal number num .
STDIN
Not used.
INPUT FILES
None.
ENVIRONMENT VARIABLES
The following environment variables affect the execution of
echo :
LANG- Provide a default value for the internationalisation variables that are
unset or null. If
LANGis unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined. LC_ALL- If set to a non-empty string value, override the values of all the other internationalisation variables.
LC_CTYPE- Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).
LC_MESSAGES- Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
NLSPATH- Determine the location of message catalogues for the processing of LC_MESSAGES .
ASYNCHRONOUS EVENTS
Default.
STDOUT
The echo utility arguments will be
separated by single space characters and a newline character will follow the
last argument. Output transformations will occur based on the escape
sequences in the input; see the OPERANDS section.
STDERR
Used only for diagnostic messages.
OUTPUT FILES
None.
EXTENDED DESCRIPTION
None.
EXIT STATUS
The following exit values are returned:
CONSEQUENCES OF ERRORS
Default.
APPLICATION USAGE
It is not possible to use echo portably
across all systems that are not XSI-conformant unless both
-n (as the first argument) and escape sequences are
omitted.
The printf utility can be used portably to
emulate any of the traditional behaviours of the
echo utility as follows:
- The XSI
echois equivalent to:printf "%b\n" "$*"
- The BSD
echois equivalent to:if [ "X$1" = "X-n" ] then shift printf "%s" "$*" else printf "%s\n" "$*" fi
New applications are encouraged to use printf
instead of echo.
EXAMPLES
None.
FUTURE DIRECTIONS
None.