4Command-Line Programs
Much of the power that Unix brings to the user is in the command-line tools, where the user can set up pipelines of independent programs that manipulate data. It’s time to take a peek under the hood of a typical command-line tool and see how it works, as many of the command-line concepts (processing arguments, checking the environment) apply to any Unix program. Here you are going to write a program that filters its input by changing any letters it finds to upper or lower case.
Figure 4.1 shows a typical command-line program along with its three communication streams. The standard-in stream (also called “stdin”) supplies data to the program. The data you are to process comes from standard-in. You are done once the stream ...
Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide 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.