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