upgrading to sun-lamp's sh(1) + patches from Nate.
[unix-history] / bin / sh / bltin / echo.1
CommitLineData
15637ed4
RG
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.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\" notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\" notice, this list of conditions and the following disclaimer in the
14.\" documentation and/or other materials provided with the distribution.
15.\" 3. All advertising materials mentioning features or use of this software
16.\" must display the following acknowledgement:
17.\" This product includes software developed by the University of
18.\" California, Berkeley and its contributors.
19.\" 4. Neither the name of the University nor the names of its contributors
20.\" may be used to endorse or promote products derived from this software
21.\" without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
68de1ca3
AM
35.\" from: @(#)echo.1 5.1 (Berkeley) 3/7/91
36.\" echo.1,v 1.4 1993/08/01 07:58:19 mycroft Exp
15637ed4
RG
37.\"
38.TH ECHO 1"March 7, 1991"
39.UC 7
40.SH NAME
41echo \- produce message in a shell script
42.SH SYNOPSIS
43.B echo
44[
45.B -n
46|
47.B -e
48]
49.I args...
50.SH COPYRIGHT
51Copyright 1989 by Kenneth Almquist.
52.SH DESCRIPTION
53.I Echo
54prints its arguments on the standard output, separated by spaces.
55Unless the
56.B -n
57option is present, a newline is output following the arguments.
58The
59.B -e
60option causes
61.I echo
62to treat the escape sequences specially, as described in the following
63paragraph. The
64.B -e
65option is the default, and is provided solely for compatibility with
66other systems.
67Only one of the options
68.B -n
69and
70.B -e
71may be given.
72.PP
73If any of the following sequences of characters is encountered during
74output, the sequence is not output. Instead, the specified action is
75performed:
76.nr i 0.6i
77.de i
78.sp
79.ti -\\niu
80\\$1 \c
81.if \w'\\$1'-\\ni .br
82..
83.in 1.1i
84.ta 0.6i
85.i \eb
86A backspace character is output.
87.i \ec
88Subsequent output is suppressed. This is normally used at the end of the
89last argument to suppress the trailing newline that
90.I echo
91would otherwise output.
92.i \ef
93Output a form feed.
94.i \en
95Output a newline character.
96.i \er
97Output a carriage return.
98.i \et
99Output a (horizontal) tab character.
100.i \ev
101Output a vertical tab.
102.i \e0\fIdigits\fR
103Output the character whose value is given by zero to three digits.
104If there are zero digits, a nul character is output.
105.i \e\e
106Output a backslash.
107.in -1.1i
108.SH HINTS
109Remember that backslash is special to the shell and needs to be escaped.
110To output a message to standard error, say
111.sp
112.ti +1i
113echo message >&2
114.SH BUGS
115The octal character escape mechanism (\e0\fIdigits\fR) differs from the
116C language mechanism.
117.PP
118There is no way to force
119.I echo
120to treat its arguments literally, rather than interpreting them as
121options and escape sequences.