Commit | Line | Data |
---|---|---|
d1b73048 KB |
1 | .\" Copyright (c) 1991, 1993 |
2 | .\" The Regents of the University of California. All rights reserved. | |
4f637f59 KB |
3 | .\" |
4 | .\" This code is derived from software contributed to Berkeley by | |
5 | .\" Kenneth Almquist. | |
8aaff48c | 6 | .\" Copyright 1989 by Kenneth Almquist |
4f637f59 | 7 | .\" |
8aaff48c | 8 | .\" %sccs.include.redist.roff% |
4f637f59 | 9 | .\" |
cbfe5a6d | 10 | .\" @(#)echo.1 8.2 (Berkeley) %G% |
4f637f59 | 11 | .\" |
8aaff48c CL |
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 | |
4f637f59 KB |
24 | prints its arguments on the standard output, separated by spaces. |
25 | Unless the | |
8aaff48c | 26 | .Fl n |
4f637f59 KB |
27 | option is present, a newline is output following the arguments. |
28 | The | |
8aaff48c | 29 | .Fl e |
4f637f59 | 30 | option causes |
8aaff48c | 31 | .Nm echo |
4f637f59 | 32 | to treat the escape sequences specially, as described in the following |
8aaff48c CL |
33 | paragraph. |
34 | The | |
35 | .Fl e | |
4f637f59 KB |
36 | option is the default, and is provided solely for compatibility with |
37 | other systems. | |
38 | Only one of the options | |
8aaff48c | 39 | .Fl n |
4f637f59 | 40 | and |
8aaff48c | 41 | .Fl e |
4f637f59 | 42 | may be given. |
8aaff48c | 43 | .Pp |
4f637f59 KB |
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: | |
8aaff48c CL |
47 | .Bl -tag -width indent |
48 | .It Li \eb | |
4f637f59 | 49 | A backspace character is output. |
8aaff48c | 50 | .It Li \ec |
4f637f59 KB |
51 | Subsequent output is suppressed. This is normally used at the end of the |
52 | last argument to suppress the trailing newline that | |
8aaff48c | 53 | .Nm echo |
4f637f59 | 54 | would otherwise output. |
8aaff48c | 55 | .It Li \ef |
4f637f59 | 56 | Output a form feed. |
8aaff48c | 57 | .It Li \en |
4f637f59 | 58 | Output a newline character. |
8aaff48c | 59 | .It Li \er |
4f637f59 | 60 | Output a carriage return. |
8aaff48c | 61 | .It Li \et |
4f637f59 | 62 | Output a (horizontal) tab character. |
8aaff48c | 63 | .It Li \ev |
4f637f59 | 64 | Output a vertical tab. |
8aaff48c | 65 | .It Li \e0 Ns Ar digits |
4f637f59 KB |
66 | Output the character whose value is given by zero to three digits. |
67 | If there are zero digits, a nul character is output. | |
8aaff48c | 68 | .It Li \e\e |
4f637f59 | 69 | Output a backslash. |
8aaff48c CL |
70 | .El |
71 | .Sh HINTS | |
4f637f59 KB |
72 | Remember that backslash is special to the shell and needs to be escaped. |
73 | To output a message to standard error, say | |
8aaff48c CL |
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 | |
4f637f59 | 80 | C language mechanism. |
8aaff48c | 81 | .Pp |
4f637f59 | 82 | There is no way to force |
8aaff48c | 83 | .Nm echo |
4f637f59 KB |
84 | to treat its arguments literally, rather than interpreting them as |
85 | options and escape sequences. |