Skip to Content
Small, Sharp Software Tools
book

Small, Sharp Software Tools

by Brian P. Hogan
June 2019
Intermediate to advanced
328 pages
7h 27m
English
Pragmatic Bookshelf
Content preview from Small, Sharp Software Tools

Handling Standard Error Streams

When errors occur in commands, you’ll see both the standard output and standard error streams displayed on your screen. This makes it easier for you to see when something went wrong, but it makes it more difficult for you to send the output to a file or another program. To get around this, well-behaved programs separate diagnostics messages and other error messages to the standard error stream and leave it up to you to split them out. Like output, you’ll use a file descriptor to either send the errors to a file or suppress the messages.

Let’s look at an example of this in action. Use the find command to look at the contents of the /root folder, which you don’t have access to view:

 $ ​​find​​ ​​/root/
 /root/ ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

The VimL Primer

The VimL Primer

Benjamin Klein
What Employees Want Most in Uncertain Times

What Employees Want Most in Uncertain Times

Kristine W. Powers, Jessica B.B. Diaz

Publisher Resources

ISBN: 9781680507003Errata Page