echo
PURPOSE
Writes its arguments to standard output.
SYNOPSIS
echo [ arg ] ...
DESCRIPTION
The echo command writes its arguments to standard output.
strings are separated by blanks and a new-line character
follows the last string. Use echo to produce diagnostic
messages in command files and to send data into a pipe.
The echo command recognizes the following escape con-
ventions:
\b Display a backspace character.
\c Suppress the new-line character.
\f Display a form-feed character.
\n Display a new-line character.
\r Display a carriage return character.
\t Display a tab character.
\\ Display a backslash character.
\num Display an 8-bit character. whose ASCII value is
the 1-, 2-or 3-digit octal number num. The first
digit of num must be a zero.
EXAMPLES
1. To write a message to standard output:
echo Please insert diskette . . .
2. To display a message containing special characters:
echo "\n\n\nI'm at lunch.\nI'll be back at 1:00."
This skips three lines and displays the message:
I'm at lunch.
I'll be back at 1:00.
Note: You must quote the message if it contains
escape sequences like "\n". Otherwise, the shell
treats the "\" specially. See page for details
about quoting.
3. To use echo with pattern-matching characters:
echo The back-up files are: *.bak
This displays the message "The back-up files are:"
followed by the file names in the current directory
ending with ".bak".
4. To add a single line of text to a file:
echo Remember to set the shell search path to $PATH. >>notes
This adds the message to the end of the file "notes"
after the shell substitutes the value of the shell
variable PATH.
5. To write a message to the standard error output:
echo Error: file already exists. >&2
Use this in shell procedures to write error messages.
If the ">&2" is omitted, then the message is written
to the standard output. For details about this type
of file redirection, see "Input and Output Redi-
rection Using File Descriptors."
RELATED INFORMATION
The following commands: "csh" and "sh."
Note: The csh command contains a built-in subcommand
named echo. The command and subcommand do not neces-
sarily work the same way. For information on the subcom-
mand, see the csh command.