Chapter 5. Working with Pipes

A quick review for those who don’t swim in *nix operating systems or aren’t familiar with pipes from other programming experience:

Every program has three basic file descriptors: 0, 1, and 2. These file descriptors have been traditionally named STDIN, STDOUT, and STDERR, respectively—commonly referred to as pipes. Most programs output any kind of error message to STDERR. In addition, any sort of output that you might want to display, pipe to a file, or parse is output to STDOUT. STDIN is used for either interactive keyboard input or to receive input from another program’s STDOUT. Here is an example of such a link between programs using pipes; the link is created by the use of the pipe (|) character in the shell:

ruby ...

Get Ruby Phrasebook now with O’Reilly online learning.

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