Many times you wish you could play back a tape of a past conversation with your teenager. To do this, you would have to have created an audio tape as the teenager was spouting the output. In the world of scripts, you might want to store the output in a file. You also might prefer to capture all the output, or just some of it. This section examines input and output redirection.

Three streams can be redirected: stdin, stdout, and stderr. By default, all three of these streams are directed to (or from in the case of stdin) your terminal device. A stream can be thought of as an open file, despite the fact that we are talking about the terminal device being open. Therefore, the shell deals with stdin, stdout, and stderr as permanently ...

Get Korn Shell Programming by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.