Redirecting Input/Output

The Korn shell provides a number of operators that can be used to manipulate command input/output, files, and co-processes.

I/O Redirection Operators

<file redirect standard input from file
>file redirect standard output to file. Create file if non-existent, else overwrite.
>>file append standard output to file. Create file if non-existent.
>|file redirect standard output to file. Create file if non-existent, else overwrite even if noclobber is set.
<>file open file for reading & writing as standard input
<& close standard input
>& close standard output
<&n redirect standard input from file descriptor n
>&n redirect standard output to file descriptor n
n<file redirect file descriptor n from file
n>file redirect file ...

Get Korn Shell: Unix and Linux Programming Manual, Third Edition, The 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.