date and time created 91/03/07 20:22:38 by bostic
[unix-history] / usr / src / bin / sh / bltin / echo.1
CommitLineData
4f637f59
KB
1.\" Copyright (c) 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Kenneth Almquist.
6.\"
7.\" %sccs.include.redist.man%
8.\"
9.\" @(#)echo.1 5.1 (Berkeley) %G%
10.\"
11.TH ECHO 1""
12.UC 7
13.SH NAME
14echo \- produce message in a shell script
15.SH SYNOPSIS
16.B echo
17[
18.B -n
19|
20.B -e
21]
22.I args...
23.SH COPYRIGHT
24Copyright 1989 by Kenneth Almquist.
25.SH DESCRIPTION
26.I Echo
27prints its arguments on the standard output, separated by spaces.
28Unless the
29.B -n
30option is present, a newline is output following the arguments.
31The
32.B -e
33option causes
34.I echo
35to treat the escape sequences specially, as described in the following
36paragraph. The
37.B -e
38option is the default, and is provided solely for compatibility with
39other systems.
40Only one of the options
41.B -n
42and
43.B -e
44may be given.
45.PP
46If any of the following sequences of characters is encountered during
47output, the sequence is not output. Instead, the specified action is
48performed:
49.nr i 0.6i
50.de i
51.sp
52.ti -\\niu
53\\$1 \c
54.if \w'\\$1'-\\ni .br
55..
56.in 1.1i
57.ta 0.6i
58.i \eb
59A backspace character is output.
60.i \ec
61Subsequent output is suppressed. This is normally used at the end of the
62last argument to suppress the trailing newline that
63.I echo
64would otherwise output.
65.i \ef
66Output a form feed.
67.i \en
68Output a newline character.
69.i \er
70Output a carriage return.
71.i \et
72Output a (horizontal) tab character.
73.i \ev
74Output a vertical tab.
75.i \e0\fIdigits\fR
76Output the character whose value is given by zero to three digits.
77If there are zero digits, a nul character is output.
78.i \e\e
79Output a backslash.
80.in -1.1i
81.SH HINTS
82Remember that backslash is special to the shell and needs to be escaped.
83To output a message to standard error, say
84.sp
85.ti +1i
86echo message >&2
87.SH BUGS
88The octal character escape mechanism (\e0\fIdigits\fR) differs from the
89C language mechanism.
90.PP
91There is no way to force
92.I echo
93to treat its arguments literally, rather than interpreting them as
94options and escape sequences.