DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Automating frequent tasks

Sending a message to a terminal

There are several methods of producing output in a shell script. The first, and simplest, is the echo command used in the last example (see ``Passing arguments to a shell script'').

Note that the echo command exists in four separate forms. Originally, echo was a separate program, /bin/echo: but a version of it is now built into all three shells. There are subtle differences between them, and although the core functionality is the same (the command echo hello always prints the word ``hello'') you should check any special options you use against the relevant shell manual pages. Next, the Korn shell provides the print command. print is more versatile than echo, but cannot be used under the Bourne shell.

Finally, a more sophisticated output mechanism is the printf command. This is similar to the printf command built into awk and the callable function used by the C programming language. See printf(C) for details.

As far as the system is concerned, terminals are just a special type of file. You send data to a terminal or read data from it just like any other file.


Next topic: The echo command
Previous topic: Performing arithmetic on variables in the Korn shell

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005