xref: /original-bsd/bin/sh/bltin/echo.1 (revision d8da44a1)
Copyright (c) 1991 The Regents of the University of California.
All rights reserved.

This code is derived from software contributed to Berkeley by
Kenneth Almquist.

%sccs.include.redist.man%

@(#)echo.1 5.1 (Berkeley) 03/07/91

ECHO 1""
C 7
NAME
echo - produce message in a shell script
SYNOPSIS
echo [ -n | -e ] args...
COPYRIGHT
Copyright 1989 by Kenneth Almquist.
DESCRIPTION
Echo prints its arguments on the standard output, separated by spaces. Unless the -n option is present, a newline is output following the arguments. The -e option causes echo to treat the escape sequences specially, as described in the following paragraph. The -e option is the default, and is provided solely for compatibility with other systems. Only one of the options -n and -e may be given.

If any of the following sequences of characters is encountered during output, the sequence is not output. Instead, the specified action is performed: .nr i 0.6i \\$1 \c .. .i \eb A backspace character is output. .i \ec Subsequent output is suppressed. This is normally used at the end of the last argument to suppress the trailing newline that echo would otherwise output. .i \ef Output a form feed. .i \en Output a newline character. .i \er Output a carriage return. .i \et Output a (horizontal) tab character. .i \ev Output a vertical tab. .i \e0digits Output the character whose value is given by zero to three digits. If there are zero digits, a nul character is output. .i \e\e Output a backslash.

HINTS
Remember that backslash is special to the shell and needs to be escaped. To output a message to standard error, say echo message >&2
BUGS
The octal character escape mechanism (\e0digits) differs from the C language mechanism.

There is no way to force echo to treat its arguments literally, rather than interpreting them as options and escape sequences.