xref: /csrg-svn/bin/sh/bltin/echo.1 (revision 54250)
1*54250Scael.\" Copyright (c) 1991, 1991 The Regents of the University of California.
247100Sbostic.\" All rights reserved.
347100Sbostic.\"
447100Sbostic.\" This code is derived from software contributed to Berkeley by
547100Sbostic.\" Kenneth Almquist.
6*54250Scael.\" Copyright 1989 by Kenneth Almquist
747100Sbostic.\"
8*54250Scael.\" %sccs.include.redist.roff%
947100Sbostic.\"
10*54250Scael.\"	@(#)echo.1	5.2 (Berkeley) 06/22/92
1147100Sbostic.\"
12*54250Scael.Dd
13*54250Scael.Dt ECHO 1
14*54250Scael.Os BSD 4.4
15*54250Scael.Sh NAME
16*54250Scael.Nm echo
17*54250Scael.Nd produce message in a shell script
18*54250Scael.Sh SYNOPSIS
19*54250Scael.Nm echo
20*54250Scael.Op Fl n | Fl e
21*54250Scael.Ar args...
22*54250Scael.Sh DESCRIPTION
23*54250Scael.Nm Echo
2447100Sbosticprints its arguments on the standard output, separated by spaces.
2547100SbosticUnless the
26*54250Scael.Fl n
2747100Sbosticoption is present, a newline is output following the arguments.
2847100SbosticThe
29*54250Scael.Fl e
3047100Sbosticoption causes
31*54250Scael.Nm echo
3247100Sbosticto treat the escape sequences specially, as described in the following
33*54250Scaelparagraph.
34*54250ScaelThe
35*54250Scael.Fl e
3647100Sbosticoption is the default, and is provided solely for compatibility with
3747100Sbosticother systems.
3847100SbosticOnly one of the options
39*54250Scael.Fl n
4047100Sbosticand
41*54250Scael.Fl e
4247100Sbosticmay be given.
43*54250Scael.Pp
4447100SbosticIf any of the following sequences of characters is encountered during
4547100Sbosticoutput, the sequence is not output.  Instead, the specified action is
4647100Sbosticperformed:
47*54250Scael.Bl -tag -width indent
48*54250Scael.It Li \eb
4947100SbosticA backspace character is output.
50*54250Scael.It Li \ec
5147100SbosticSubsequent output is suppressed.  This is normally used at the end of the
5247100Sbosticlast argument to suppress the trailing newline that
53*54250Scael.Nm echo
5447100Sbosticwould otherwise output.
55*54250Scael.It Li \ef
5647100SbosticOutput a form feed.
57*54250Scael.It Li \en
5847100SbosticOutput a newline character.
59*54250Scael.It Li \er
6047100SbosticOutput a carriage return.
61*54250Scael.It Li \et
6247100SbosticOutput a (horizontal) tab character.
63*54250Scael.It Li \ev
6447100SbosticOutput a vertical tab.
65*54250Scael.It Li \e0 Ns Ar digits
6647100SbosticOutput the character whose value is given by zero to three digits.
6747100SbosticIf there are zero digits, a nul character is output.
68*54250Scael.It Li \e\e
6947100SbosticOutput a backslash.
70*54250Scael.El
71*54250Scael.Sh HINTS
7247100SbosticRemember that backslash is special to the shell and needs to be escaped.
7347100SbosticTo output a message to standard error, say
74*54250Scael.Pp
75*54250Scael.D1  echo message >&2
76*54250Scael.Sh BUGS
77*54250ScaelThe octal character escape mechanism
78*54250Scael.Pq Li \e0 Ns Ar digits
79*54250Scaeldiffers from the
8047100SbosticC language mechanism.
81*54250Scael.Pp
8247100SbosticThere is no way to force
83*54250Scael.Nm echo
8447100Sbosticto treat its arguments literally, rather than interpreting them as
8547100Sbosticoptions and escape sequences.
86