Output

As you have seen in previous chapters, most commands produce output. For example, the command

$ date

produces the current date in the terminal window:

Thu Nov 12 16:32:35 PST 2001

When a command produces output that is written to the terminal, you say that the program has printed its output to the Standard Output, or STDOUT. When you run the date command, it prints the date to STDOUT. You have also seen commands produce error messages, such as:

$ ln –s ch01.doc ch01-01.doc
ln: cannot create ch01-1.doc: File Exists

Error messages are not written to STDOUT, but instead they are written to a special type of output called Standard Error or STDERR, which is reserved for error messages. Most commands use STDERR for error messages and STDOUT ...

Get Sams Teach Yourself Shell Programming in 24 Hours, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.