diff options
author | marko <marko@FreeBSD.org> | 2000-07-17 23:37:55 +0000 |
---|---|---|
committer | marko <marko@FreeBSD.org> | 2000-07-17 23:37:55 +0000 |
commit | e33a4a87585ca714230b8531401f2a66091a0a90 (patch) | |
tree | ab7079f82f4178c99984f8aec39298d29271d26d /bin/sh/sh.1 | |
parent | e1b331a257e8d18b8345628f610b81766ba043cf (diff) | |
download | FreeBSD-src-e33a4a87585ca714230b8531401f2a66091a0a90.zip FreeBSD-src-e33a4a87585ca714230b8531401f2a66091a0a90.tar.gz |
Document the builtin echo command
Reviewed by: Matthew Hunt <mph@astro.caltech.edu>
Diffstat (limited to 'bin/sh/sh.1')
-rw-r--r-- | bin/sh/sh.1 | 64 |
1 files changed, 60 insertions, 4 deletions
diff --git a/bin/sh/sh.1 b/bin/sh/sh.1 index e0f3af9..d33f2a7 100644 --- a/bin/sh/sh.1 +++ b/bin/sh/sh.1 @@ -1269,11 +1269,9 @@ make it the first or last character listed. This section lists the commands which are builtin because they need to perform some operation that can not be performed by a separate process. In addition to -these, builtin versions of the +these, a builtin version of the .Xr printf 1 -and -.Xr echo 1 -commands are provided for efficiency. +command is provided for efficiency. .Bl -tag -width Ds .It Ic : A null command that returns a 0 (true) exit value. @@ -1349,6 +1347,64 @@ if this is different from the name that the user gave. These may be different either because the .Ev CDPATH mechanism was used or because a symbolic link was crossed. +.It Xo +.Ic echo +.Op Fl en +.Ar string +.Xc +Print +.Ar string +to the standard output with a newline appended. +.Bl -tag -width Ds +.It Fl n +Suppress the output of the trailing newline. +.It Fl e +Process C-style backslash escape sequences. +.Ic echo +understands the following character escapes: +.Bl -tag -width Ds +.It \ea +Alert (ring the terminal bell) +.It \eb +Backspace +.It \ec +Suppress the trailing newline (this has the side-effect of truncating the +line if it is not the last character) +.It \ee +The ESC character (ASCII 0x1b) +.It \ef +Formfeed +.It \en +Newline +.It \er +Carriage return +.It \et +Horizontal tab +.It \ev +Vertical tab +.It \e\e +Literal backslash +.It \e0nnn +(Zero) The character whose octal value is nnn +.El +.Pp +If +.Ar string +is not enclosed in quotes then the backslash itself must be escaped +with a backslash to protect it from the shell. For example +.Bd -literal -offset indent +$ echo -e "a\evb" +a + b +$ echo -e a\e\evb +a + b +$ echo -e "a\e\eb" +a\eb +$ echo -e a\e\e\e\eb +a\eb +.Ed +.El .It Ic eval Ar string ... Concatenate all the arguments with spaces. Then re-parse and execute the command. |