The Android Open Source Project | 4f6e8d7 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1 | .\" $NetBSD: echo.1,v 1.13 2003/08/07 09:05:40 agc Exp $ |
| 2 | .\" |
| 3 | .\" Copyright (c) 1991, 1993 |
| 4 | .\" The Regents of the University of California. All rights reserved. |
| 5 | .\" |
| 6 | .\" This code is derived from software contributed to Berkeley by |
| 7 | .\" Kenneth Almquist. |
| 8 | .\" Copyright 1989 by Kenneth Almquist |
| 9 | .\" |
| 10 | .\" Redistribution and use in source and binary forms, with or without |
| 11 | .\" modification, are permitted provided that the following conditions |
| 12 | .\" are met: |
| 13 | .\" 1. Redistributions of source code must retain the above copyright |
| 14 | .\" notice, this list of conditions and the following disclaimer. |
| 15 | .\" 2. Redistributions in binary form must reproduce the above copyright |
| 16 | .\" notice, this list of conditions and the following disclaimer in the |
| 17 | .\" documentation and/or other materials provided with the distribution. |
| 18 | .\" 3. Neither the name of the University nor the names of its contributors |
| 19 | .\" may be used to endorse or promote products derived from this software |
| 20 | .\" without specific prior written permission. |
| 21 | .\" |
| 22 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
| 23 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 24 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 25 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| 26 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 27 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 28 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 29 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 30 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | .\" SUCH DAMAGE. |
| 33 | .\" |
| 34 | .\" @(#)echo.1 8.1 (Berkeley) 5/31/93 |
| 35 | .\" |
| 36 | .Dd May 31, 1993 |
| 37 | .Dt ECHO 1 |
| 38 | .Os |
| 39 | .Sh NAME |
| 40 | .Nm echo |
| 41 | .Nd produce message in a shell script |
| 42 | .Sh SYNOPSIS |
| 43 | .Nm |
| 44 | .Op Fl n | Fl e |
| 45 | .Ar args ... |
| 46 | .Sh DESCRIPTION |
| 47 | .Nm |
| 48 | prints its arguments on the standard output, separated by spaces. |
| 49 | Unless the |
| 50 | .Fl n |
| 51 | option is present, a newline is output following the arguments. |
| 52 | The |
| 53 | .Fl e |
| 54 | option causes |
| 55 | .Nm |
| 56 | to treat the escape sequences specially, as described in the following |
| 57 | paragraph. |
| 58 | The |
| 59 | .Fl e |
| 60 | option is the default, and is provided solely for compatibility with |
| 61 | other systems. |
| 62 | Only one of the options |
| 63 | .Fl n |
| 64 | and |
| 65 | .Fl e |
| 66 | may be given. |
| 67 | .Pp |
| 68 | If any of the following sequences of characters is encountered during |
| 69 | output, the sequence is not output. Instead, the specified action is |
| 70 | performed: |
| 71 | .Bl -tag -width indent |
| 72 | .It Li \eb |
| 73 | A backspace character is output. |
| 74 | .It Li \ec |
| 75 | Subsequent output is suppressed. This is normally used at the end of the |
| 76 | last argument to suppress the trailing newline that |
| 77 | .Nm |
| 78 | would otherwise output. |
| 79 | .It Li \ef |
| 80 | Output a form feed. |
| 81 | .It Li \en |
| 82 | Output a newline character. |
| 83 | .It Li \er |
| 84 | Output a carriage return. |
| 85 | .It Li \et |
| 86 | Output a (horizontal) tab character. |
| 87 | .It Li \ev |
| 88 | Output a vertical tab. |
| 89 | .It Li \e0 Ns Ar digits |
| 90 | Output the character whose value is given by zero to three digits. |
| 91 | If there are zero digits, a nul character is output. |
| 92 | .It Li \e\e |
| 93 | Output a backslash. |
| 94 | .El |
| 95 | .Sh HINTS |
| 96 | Remember that backslash is special to the shell and needs to be escaped. |
| 97 | To output a message to standard error, say |
| 98 | .Pp |
| 99 | .D1 echo message \*[Gt]\*[Am]2 |
| 100 | .Sh BUGS |
| 101 | The octal character escape mechanism |
| 102 | .Pq Li \e0 Ns Ar digits |
| 103 | differs from the |
| 104 | C language mechanism. |
| 105 | .Pp |
| 106 | There is no way to force |
| 107 | .Nm |
| 108 | to treat its arguments literally, rather than interpreting them as |
| 109 | options and escape sequences. |