Input/Output Redirection

The Korn shell provides a number of operators than can be used to manipulate command input/output and files. For example, you can save command output to a file. Or instead of typing in the input to a command, it can be taken from a file. The following sections describe some of the features of Korn shell I/O redirection.

Redirecting Standard Output

The standard output of a command is by default directed to your terminal. By using the > symbol, the standard output of a command can be redirected to a file, instead of your terminal. In this example, the standard output of the echo command is put into the file p.out:

						$ echo "Hello" > p.out
						$ cat p.out

If the file doesn't exist, then it is created. Otherwise, the ...

Get Korn Shell: Unix and Linux Programming Manual, Third Edition, The now with O’Reilly online learning.

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