| 1 | .\" Copyright (c) 1991, 1993 |
| 2 | .\" The Regents of the University of California. All rights reserved. |
| 3 | .\" |
| 4 | .\" This code is derived from software contributed to Berkeley by |
| 5 | .\" Kenneth Almquist. |
| 6 | .\" Copyright 1989 by Kenneth Almquist |
| 7 | .\" |
| 8 | .\" %sccs.include.redist.roff% |
| 9 | .\" |
| 10 | .\" @(#)echo.1 8.2 (Berkeley) %G% |
| 11 | .\" |
| 12 | .Dd |
| 13 | .Dt ECHO 1 |
| 14 | .Os BSD 4.4 |
| 15 | .Sh NAME |
| 16 | .Nm echo |
| 17 | .Nd produce message in a shell script |
| 18 | .Sh SYNOPSIS |
| 19 | .Nm echo |
| 20 | .Op Fl n | Fl e |
| 21 | .Ar args... |
| 22 | .Sh DESCRIPTION |
| 23 | .Nm Echo |
| 24 | prints its arguments on the standard output, separated by spaces. |
| 25 | Unless the |
| 26 | .Fl n |
| 27 | option is present, a newline is output following the arguments. |
| 28 | The |
| 29 | .Fl e |
| 30 | option causes |
| 31 | .Nm echo |
| 32 | to treat the escape sequences specially, as described in the following |
| 33 | paragraph. |
| 34 | The |
| 35 | .Fl e |
| 36 | option is the default, and is provided solely for compatibility with |
| 37 | other systems. |
| 38 | Only one of the options |
| 39 | .Fl n |
| 40 | and |
| 41 | .Fl e |
| 42 | may be given. |
| 43 | .Pp |
| 44 | If any of the following sequences of characters is encountered during |
| 45 | output, the sequence is not output. Instead, the specified action is |
| 46 | performed: |
| 47 | .Bl -tag -width indent |
| 48 | .It Li \eb |
| 49 | A backspace character is output. |
| 50 | .It Li \ec |
| 51 | Subsequent output is suppressed. This is normally used at the end of the |
| 52 | last argument to suppress the trailing newline that |
| 53 | .Nm echo |
| 54 | would otherwise output. |
| 55 | .It Li \ef |
| 56 | Output a form feed. |
| 57 | .It Li \en |
| 58 | Output a newline character. |
| 59 | .It Li \er |
| 60 | Output a carriage return. |
| 61 | .It Li \et |
| 62 | Output a (horizontal) tab character. |
| 63 | .It Li \ev |
| 64 | Output a vertical tab. |
| 65 | .It Li \e0 Ns Ar digits |
| 66 | Output the character whose value is given by zero to three digits. |
| 67 | If there are zero digits, a nul character is output. |
| 68 | .It Li \e\e |
| 69 | Output a backslash. |
| 70 | .El |
| 71 | .Sh HINTS |
| 72 | Remember that backslash is special to the shell and needs to be escaped. |
| 73 | To output a message to standard error, say |
| 74 | .Pp |
| 75 | .D1 echo message >&2 |
| 76 | .Sh BUGS |
| 77 | The octal character escape mechanism |
| 78 | .Pq Li \e0 Ns Ar digits |
| 79 | differs from the |
| 80 | C language mechanism. |
| 81 | .Pp |
| 82 | There is no way to force |
| 83 | .Nm echo |
| 84 | to treat its arguments literally, rather than interpreting them as |
| 85 | options and escape sequences. |