cat -u

Rahul Dhesi dhesi at bsu-cs.UUCP
Mon Dec 12 02:52:05 AEST 1988


In article <146 at minya.UUCP> jc at minya.UUCP (John Chambers) writes:
>What ever happened to the original Unix Philosophy of lots of little
>programs, each of which did exactly one job well, and which could be
>fitted together to do bigger jobs?

With the right point of view, this question becomes non-sequitorial.
>From the user's point of view, where the code lies (i.e., whether it's
in separate programs called ex and vi, or in one program with two
links) is not relevant.  What matters is the way the user interface
looks.

Think of "cat", "cat -u", and "cat -s" as separate programs.
Then create a pipeline like this:

     cat files ... | cat -u | cat -s

Now go "AHA!" with the realization that both cat -u and cat -s will
accept multiple filenames, so cat alone isn't needed any more:

     cat -u files ... | cat -s

At this point the purist stops and is deliriously happy at using two
small, single-purpose utilities.  The pragmatist continues to optimize
by eliminating an extra process and an extra pipe and gets:

     cat -us files ...

Whether you need three single-purpose utilities, or a single
triple-purpose utility, the 4.3BSD cat delivers.

By the way, if you took the one-function-per-program philosophy too far,
you would have separate commands such as cc-g, cc-O, cc-ld, cc-E, etc.,
instead of having a single front-end called cc that accepts a large
number of switches.
-- 
Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee}!bsu-cs!dhesi



More information about the Comp.unix.wizards mailing list