Output Redirection

In the last chapter, we discussed the redirection of stdin, stdout, and stderr. By far the most commonly used is output redirection. You have seen that output can be redirected into a file, using the >, or appended to an existing file, using >>. Output can be redirected for the entire script, for the output of a subshell, for the output of a command, or for the output of a loop. The subshell and loop options are not intuitive, so we'll take a look at them next.

Subshell Output Redirection

You can run commands or scripts within a subshell by surrounding them with a set of parentheses on the command line. This forces the creation of a new process running a new copy of the Korn Shell program. Therefore, any changes made to aliases, ...

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.