Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

sh(1)

ascii(5)

echo(1)

NAME

echo − echo arguments

SYNOPSIS

echo [ argument ] ...
echo [ −n ] [ argument ]

AVAILABILITY

SUNWcsu

DESCRIPTION

echo writes its arguments separated by blanks and terminated by a new-line on the standard output. 

/usr/bin/sh (Bourne shell) understands the following C-like escape conventions, however, beware of conflicts with the shell’s use of \:

Note that the escape conventions are not available if the BSD version of the Bourne shell echo command is used. (See OPTIONS section)

\b backspace

\c print line without new-line

\f form-feed

\n new-line

\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. 

OPTIONS

The −n option is available to /usr/bin/sh users only if /usr/ucb precedes /usr/bin in the user’s PATH, however, then the backslash characters, described above, are NOT available.  −n is available to /usr/bin/csh users, regardless of PATH:

−n Do not add the newline to the output. 

SEE ALSO

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, typing: 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 digitsIncorrect:echo "\0337"  | od -xc
produces:df0a(hex)
337(ascii)
3 digitsCorrect:echo "\00337" | od -xc
produces:lb37 0a00(hex)
033 7(ascii)

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

SunOS 5.2  —  Last change: 7 Jan 1993

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