Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

csh(1)

ksh(1)

sh(1)

ascii(5)

echo(1)  —  USER COMMANDS

NAME

echo − echo arguments

SYNOPSIS

echo [ −n ] [ arg ] ... 

DESCRIPTION

echo writes its arguments separated by blanks and terminated by a newline on the standard output.  This syntax is used by the shell [sh(1) and ksh(1)] built-in echo commands as well as the user command /usr/bin/echo. 

The -n option is available only using the sh(1) built-in echo command and is only available when the directory /usr/ucb preceeds the directory /usr/bin in the user’s PATH environment variable.  When the -n option is available, none of the other C-like escape sequences described below are available to the user. 

The following C-like escape conventions are supported; beware of conflicts with the shell’s use of \:

\b backspace

\c print line without newline

\f form-feed

\n newline

\r carriage return

\t tab

\v vertical tab

\\ backslash

\0n where n is the 8-bit character whose ASCII code is the 1-, 2- or 3-digit octal number representing that character. 

echo is useful for producing diagnostics in command files, for sending known data into a pipe, and for displaying the contents of environment variables. 

INTERNATIONAL FUNCTIONS

Arguments containing characters from supplementary code sets can be specified.  Note that when octal notation is used, each byte of multibyte characters should be preceded by a backslash (\).

SEE ALSO

csh(1), ksh(1), sh(1), ascii(5). 

NOTES

The −n option is a transition aid for BSD applications, and may not be supported in future releases. 

When representing an 8-bit character by using the escape convention \0n, the n must always be preceded by the digit zero (0). 

For example, entering: echo ´WARNING:\07´ will print the phrase WARNING: and sound the bell on your terminal.  The use of single (or double) quotes (or two backslashes) is required to protect the “\” that precedes the “07”.

Following the \0, up to three digits are used in constructing the octal output character.  If, following the \0n, you want to echo additional digits that are not part of the octal representation, you must use the full 3-digit n.  For example, if you want to echo “ESC 7” you must use the three digits “033” rather than just the two digits “33” after the \0. 

2 digits Incorrect: echo "\0337"  | od -xc
produces: df0a                  (hex)
337                   (ascii)
3 digits Correct: echo "\00337" | od -xc
produces: lb37 0a00            (hex)
033 7                (ascii)

For the octal equivalents of each character, see ascii(5). 

  —  Essential Utilities

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026