ugh.book

(singke) #1
Find 167

I don’t want to have to check out every directory in the tree I give to
find—that should be find’s job, dammit. I don’t want to mung the
system software every time misfeatures like this come up. I don’t
want to waste my time fighting SUN or the entire universe of Unix
weeniedom. I don’t want to use Unix. Hate, hate, hate, hate, hate,
hate, hate.

—Ken (feeling slightly better but still pissed)

Writing a complicated shell script that actually does something with the
files that are found produces strange results, a sad result of the shell’s
method for passing arguments to commands.


Date: Sat, 12 Dec 92 01:15:52 PST
From: Jamie Zawinski <[email protected]>
Subject: Q: what’s the opposite of ‘find?’ A: ‘lose.’
To: UNIX-HATERS

I wanted to find all .el files in a directory tree that didn’t have a
corresponding .elc file. That should be easy. I tried to use find.

What was I thinking.

First I tried:

% find. -name ’*.el’ -exec ’test -f {}c’
find: incomplete statement

Oh yeah, I remember, it wants a semicolon.

% find. -name ’*.el’ -exec ’test -f {}c’ \;
find: Can’t execute test -f {}c:
No such file or directory

Oh, great. It’s not tokenizing that command like most other things
do.

% find. -name ’*.el’ -exec test -f {}c \;

Well, that wasn’t doing anything...

% find. -name ’*.el’ -exec echo test -f {}c \;
test -f c
test -f c
test -f c
test -f c
Free download pdf