Pipes Versus Redirection

The pipe operator (|) indicates that the output of the command on the left is presented to the command on the right as its stdin. As such, it is related to the redirection operators. However, writing to a pipe, although close in concept, is radically different in action and implementation. The concept is close because both involve taking the stdout from a program and doing something different with it. However, the pipe sends the output to another command for processing, whereas the redirect (>) sends the stdout to a file.

This concept can get confusing if you are not used to it. Just remember that the item to the right of a pipe is a command (usually a filter of some kind), whereas the item to the right of a redirect ...

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.