164 csh, pipes, and find “There are no Unix experts, in the naive sense of an exalted group whose knowledge is exhaustive and who need not learn more.” Here I must disagree. It is clear that an attempt to master the absurdi- ties of Unix would exhaust anyone. Some programs even go out of their way to make sure that pipes and file redirection behave differently from one another: From: Leigh L. Klotz klotz@adoc.xerox.com To: UNIX-HATERS Subject: | vs. Date: Thu, 8 Oct 1992 11:37:14 PDT collard% xtpanel -file xtpanel.out .login unmatched braces unmatched braces unmatched braces 3 unmatched right braces present collard% cat .login | xtpanel -file xtpanel.out collard% You figure it out. Find The most horrifying thing about Unix is that, no matter how many times you hit yourself over the head with it, you never quite manage to lose consciousness. It just goes on and on. —Patrick Sobalvarro Losing a file in a large hierarchical filesystem is a common occurrence. (Think of Imelda Marcos trying to find her pink shoes with the red toe rib- bon among all her closets.) This problem is now hitting PC and Apple users with the advent of large, cheap disks. To solve this problem computer sys- tems provide programs for finding files that match given criteria, that have a particular name, or type, or were created after a particular date. The Apple Macintosh and Microsoft Windows have powerful file locators that are relatively easy to use and extremely reliable. These file finders were
Find 165 designed with a human user and modern networking in mind. The Unix file finder program, find, wasn’t designed to work with humans, but with cpio—a Unix backup utility program. Find couldn’t anticipate networks or enhancements to the file system such as symbolic links even after exten- sive modifications, it still doesn’t work well with either. As a result, despite its importance to humans who’ve misplaced their files, find doesn’t work reliably or predictably. The authors of Unix tried to keep find up to date with the rest of Unix, but it is a hard task. Today’s find has special flags for NFS file systems, sym- bolic links, executing programs, conditionally executing programs if the user types “y,” and even directly archiving the found files in cpio or cpio-c format. Sun Microsystems modified find so that a background daemon builds a database of every file in the entire Unix file system which, for some strange reason, the find command will search if you type “find file- name” without any other arguments. (Talk about a security violation!) Despite all of these hacks, find still doesn’t work properly. For example, the csh follows symbolic links, but find doesn’t: csh was written at Berkeley (where symbolic links were implemented), but find dates back to the days of AT&T, pre-symlink. At times, the culture clash between East and West produces mass confusion. Date: Thu, 28 Jun 1990 18:14 EDT From: pgs@crl.dec.com Subject: more things to hate about Unix To: UNIX-HATERS This is one of my favorites. I’m in some directory, and I want to search another directory for files, using find. I do: po pwd /ath/u1/pgs po find ~halstead -name "*.trace" -print po The files aren’t there. But now: po cd ~halstead po find . -name "*.trace" -print ./learnX/fib-3.trace ./learnX/p20xp20.trace ./learnX/fib-3i.trace ./learnX/fib-5.trace ./learnX/p10xp10.trace
Previous Page Next Page