Home > Articles > Operating Systems, Server > Linux/UNIX/Open Source

  • Print
  • + Share This
Like this article? We recommend

Standard Input, Standard Output

On the UNIX command line, you can join programs by using pipes. This is nice for very simple workflows. It lacks flexibility, however, due to the mechanism used to implement it. Originally, programs read input and wrote output. On interactive computers, it became beneficial to have two output streams—one for expected output and one for error messages. Now, on a UNIX system, each program has a single input stream and two output streams.

This limitation means that some things simply cannot be done with a UNIX command line. Consider a filter that de-multiplexes a movie clip into video and audio streams. At best, you could send the video stream to the standard output and the audio to the standard error, but then you would have no means of reporting errors.

To make things worse, each of these streams is unidirectional. This means that there can be no negotiation between two filters. Ideally, the source filter should be able to advertise a selection of output formats, and the destination filter should be able to select one. On a UNIX command line, this must be done in advance by the user. Once the filters are running, there's no way of changing the output format—for example, to reduce the bit-rate if less network bandwidth is available.

  • + Share This
  • 🔖 Save To Your Account