ugh.book

(singke) #1

148 csh, pipes, and find


options that control everything from sort order to the number of columns in
which the printout appears—all functions that are better handled with other
tools (and once were). The find command writes cpio-formatted output
files in addition to finding files (something easily done by connecting the
two commands with an infamous Unix pipe). Today, the Unix equivalent
of a power drill would have 20 dials and switches, come with a
nonstandard plug, require the user to hand-wind the motor coil, and not
accept 3/8" or 7/8" drill bits (though this would be documented in the
BUGS section of its instruction manual).

Unlike the tools in the hardware store, most Unix power tools are flawed
(sometimes fatally for files): for example, there is, tar, with its arbitrary
100-characters-in-a-pathname limit, or Unix debuggers, which overwrite
your “core” files with their own “core” files when they crash.

Unix’s “power tools” are more like power switchblades that slice off the
operator’s fingers quickly and efficiently.

The Shell Game


The inventors of Unix had a great idea: make the command processor be
just another user-level program. If users didn’t like the default command
processor, they could write their own. More importantly, shells could
evolve, presumably so that they could become more powerful, flexible, and
easy to use.

It was a great idea, but it backfired. The slow accretion of features caused a
jumble. Because they weren’t designed, but evolved, the curse of all pro-
gramming languages, an installed base of programs, hit them extra hard. As
soon as a feature was added to a shell, someone wrote a shell script that
depended on that feature, thereby ensuring its survival. Bad ideas and fea-
tures don’t die out.

The result is today’s plethora of incomplete, incompatible shells (descrip-
tions of each shell are from their respective man pages):

sh A command programming language that executes
commands read from a terminal or a file.
jsh Identical [to sh], but with csh-style job control
enabled.
csh A shell with C-like syntax.
Free download pdf