Shell Scripts v. Command Options (was: Re: small bug in who(1) of SVR3)

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Tue Jan 22 00:48:31 AEST 1991


In article <4581 at lib.tmc.edu> jmaynard at thesis1.hsch.utexas.edu (Jay Maynard) writes:
> In article <1396:Jan1811:54:2091 at kramden.acf.nyu.edu> brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
> >In article <1991Jan16.175908.3338 at zoo.toronto.edu> henry at zoo.toronto.edu (Henry Spencer) writes:
> >> I don't advocate callous disregard for efficiency -- that way lies GNU
> >> Emacs and other excesses -- but a sense of perspective is needed.  Hacking
> >> C code to avoid writing a one-line shell script is a gross waste of time
> >> and money unless that program is truly critical to system performance.
> (Henry, that first sentence would normally be .sigfile material. Bravo!)

Hmmm. Up to the second dash, or the whole sentence? It'll only fit up to
``Emacs'' on one line (or two half-lines).

> >That depends on your user community. In general, code that will be
> >distributed to thousands of sites should be written efficiently.
> For heaven's sake, why?

I just gave several colleagues a good laugh by taking that response out
of context. ``What is he trying to do, sell code to the government?''

The answer is ``To save as much computer time around the world as
possible.'' If you waste a second on a program run ten times every day
at thousands of sites, you waste thousands of hours of computer time
every year. Is that really worth the five minutes that it takes to write
``users'' in C instead of sh? You're going to waste five minutes writing
the documentation anyway.

> There's a tradeoff there, and the most effort towards
> efficiency is best concentrated on those parts of the system where it makes a
> significant difference.

I agree entirely. Read what I said again: Code that will be distributed
to thousands of sites should be written efficiently. If a shell script
is (for all practical purposes) just as efficient as a C program, then
there's no problem. But utmp checkers are so easy to write in any
language that there's no point using anything but C.

---Dan



More information about the Comp.bugs.sys5 mailing list