xref: /csrg-svn/bin/sh/bltin/echo.1 (revision 69276)
160695Sbostic.\" Copyright (c) 1991, 1993
260695Sbostic.\"	The Regents of the University of California.  All rights reserved.
347100Sbostic.\"
447100Sbostic.\" This code is derived from software contributed to Berkeley by
547100Sbostic.\" Kenneth Almquist.
654250Scael.\" Copyright 1989 by Kenneth Almquist
747100Sbostic.\"
854250Scael.\" %sccs.include.redist.roff%
947100Sbostic.\"
10*69276Schristos.\"	@(#)echo.1	8.2 (Berkeley) 05/04/95
1147100Sbostic.\"
1254250Scael.Dd
1354250Scael.Dt ECHO 1
1454250Scael.Os BSD 4.4
1554250Scael.Sh NAME
1654250Scael.Nm echo
1754250Scael.Nd produce message in a shell script
1854250Scael.Sh SYNOPSIS
1954250Scael.Nm echo
2054250Scael.Op Fl n | Fl e
2154250Scael.Ar args...
2254250Scael.Sh DESCRIPTION
2354250Scael.Nm Echo
2447100Sbosticprints its arguments on the standard output, separated by spaces.
2547100SbosticUnless the
2654250Scael.Fl n
2747100Sbosticoption is present, a newline is output following the arguments.
2847100SbosticThe
2954250Scael.Fl e
3047100Sbosticoption causes
3154250Scael.Nm echo
3247100Sbosticto treat the escape sequences specially, as described in the following
3354250Scaelparagraph.
3454250ScaelThe
3554250Scael.Fl e
3647100Sbosticoption is the default, and is provided solely for compatibility with
3747100Sbosticother systems.
3847100SbosticOnly one of the options
3954250Scael.Fl n
4047100Sbosticand
4154250Scael.Fl e
4247100Sbosticmay be given.
4354250Scael.Pp
4447100SbosticIf any of the following sequences of characters is encountered during
4547100Sbosticoutput, the sequence is not output.  Instead, the specified action is
4647100Sbosticperformed:
4754250Scael.Bl -tag -width indent
4854250Scael.It Li \eb
4947100SbosticA backspace character is output.
5054250Scael.It Li \ec
5147100SbosticSubsequent output is suppressed.  This is normally used at the end of the
5247100Sbosticlast argument to suppress the trailing newline that
5354250Scael.Nm echo
5447100Sbosticwould otherwise output.
5554250Scael.It Li \ef
5647100SbosticOutput a form feed.
5754250Scael.It Li \en
5847100SbosticOutput a newline character.
5954250Scael.It Li \er
6047100SbosticOutput a carriage return.
6154250Scael.It Li \et
6247100SbosticOutput a (horizontal) tab character.
6354250Scael.It Li \ev
6447100SbosticOutput a vertical tab.
6554250Scael.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.
6854250Scael.It Li \e\e
6947100SbosticOutput a backslash.
7054250Scael.El
7154250Scael.Sh HINTS
7247100SbosticRemember that backslash is special to the shell and needs to be escaped.
7347100SbosticTo output a message to standard error, say
7454250Scael.Pp
7554250Scael.D1  echo message >&2
7654250Scael.Sh BUGS
7754250ScaelThe octal character escape mechanism
7854250Scael.Pq Li \e0 Ns Ar digits
7954250Scaeldiffers from the
8047100SbosticC language mechanism.
8154250Scael.Pp
8247100SbosticThere is no way to force
8354250Scael.Nm echo
8447100Sbosticto treat its arguments literally, rather than interpreting them as
8547100Sbosticoptions and escape sequences.
86