xref: /minix/bin/sh/bltin/echo.1 (revision 9f988b79)
1.\"	$NetBSD: echo.1,v 1.13 2003/08/07 09:05:40 agc Exp $
2.\"
3.\" Copyright (c) 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" This code is derived from software contributed to Berkeley by
7.\" Kenneth Almquist.
8.\" Copyright 1989 by Kenneth Almquist
9.\"
10.\" Redistribution and use in source and binary forms, with or without
11.\" modification, are permitted provided that the following conditions
12.\" are met:
13.\" 1. Redistributions of source code must retain the above copyright
14.\"    notice, this list of conditions and the following disclaimer.
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\"    notice, this list of conditions and the following disclaimer in the
17.\"    documentation and/or other materials provided with the distribution.
18.\" 3. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\"	@(#)echo.1	8.1 (Berkeley) 5/31/93
35.\"
36.Dd May 31, 1993
37.Dt ECHO 1
38.Os
39.Sh NAME
40.Nm echo
41.Nd produce message in a shell script
42.Sh SYNOPSIS
43.Nm
44.Op Fl n | Fl e
45.Ar args ...
46.Sh DESCRIPTION
47.Nm
48prints its arguments on the standard output, separated by spaces.
49Unless the
50.Fl n
51option is present, a newline is output following the arguments.
52The
53.Fl e
54option causes
55.Nm
56to treat the escape sequences specially, as described in the following
57paragraph.
58The
59.Fl e
60option is the default, and is provided solely for compatibility with
61other systems.
62Only one of the options
63.Fl n
64and
65.Fl e
66may be given.
67.Pp
68If any of the following sequences of characters is encountered during
69output, the sequence is not output.  Instead, the specified action is
70performed:
71.Bl -tag -width indent
72.It Li \eb
73A backspace character is output.
74.It Li \ec
75Subsequent output is suppressed.  This is normally used at the end of the
76last argument to suppress the trailing newline that
77.Nm
78would otherwise output.
79.It Li \ef
80Output a form feed.
81.It Li \en
82Output a newline character.
83.It Li \er
84Output a carriage return.
85.It Li \et
86Output a (horizontal) tab character.
87.It Li \ev
88Output a vertical tab.
89.It Li \e0 Ns Ar digits
90Output the character whose value is given by zero to three digits.
91If there are zero digits, a nul character is output.
92.It Li \e\e
93Output a backslash.
94.El
95.Sh HINTS
96Remember that backslash is special to the shell and needs to be escaped.
97To output a message to standard error, say
98.Pp
99.D1  echo message \*[Gt]\*[Am]2
100.Sh BUGS
101The octal character escape mechanism
102.Pq Li \e0 Ns Ar digits
103differs from the
104C language mechanism.
105.Pp
106There is no way to force
107.Nm
108to treat its arguments literally, rather than interpreting them as
109options and escape sequences.
110