stderr Redirection

If you are starting to feel comfortable with stdout redirection after our second visit, let's build further on that by briefly revisiting stderr redirection. Just as you might want a file full of the stdout produced by your script, or produced by a command, you also might want a file full of the error messages produced by your script. Not that you are going to want to print it out and hang it on the refrigerator, but you might want to produce a log of bad input records, erratic processing, or other exceptional events.

Don't worry, in Chapter 12, “Traps,” you learn ways to control the default action of the Korn Shell when it experiences certain errors or is sent certain signals. Consider the following example.

 $ find / -name ...

Get Korn Shell Programming by Example 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.