30 Welcome, New User! next% mkdir foo next% ls -Fd foo foo/ next% rm foo/ rm: foo/ directory next% rmdir foo/ rmdir: foo/: File exists Here’s a way to amuse and delight your friends (courtesy of Leigh Klotz). First, in great secret, do the following: % mkdir foo % touch foo/foo~ Then show your victim the results of these incantations: % ls foo* foo~ % rm foo~ rm: foo~ nonexistent % rm foo* rm: foo directory % ls foo* foo~ % Last, for a really good time, try this: % cat - - - (Hint: press ctrl-D three times to get your prompt back!) Online Documentation People vote for president more often than they read printed documentation. The only documentation that counts is the stuff that’s on-line, available at the tap of a key or the click of a mouse. The state of Unix documentation, and the amount by which it misses the bar, has earned its own chapter in this book, so we’ll take this space just to point out that Unix’s man system fails most where it is needed most: by novices. Not all commands are created equal: some are programs invoked by a shell, and some are built into a shell.8 Some have their own man pages. Some don’t. Unix expects you to know which is which. For example, wc, cp, and ls are programs outside of the shell and have man pages. But fg, jobs, set,
Error Messages and Error Checking, NOT! 31 and alias (where did those long names come from?), are examples of com- mands that live in a shell and therefore have no man pages of their own. A novice told to use “man command” to get the documentation on a com- mand rapidly gets confused as she sees some commands documented, and others not. And if she’s been set up with a shell different from the ones documented in third-party books, there’s no hope of enlightenment without consulting a guru. Error Messages and Error Checking, NOT! Novices are bound to make errors, to use the wrong command, or use the right command but the wrong options or arguments. Computer systems must detect these errors and report them back to the user. Unfortunately, Unix programs seldom bother. To the contrary, Unix seems to go out of its way to make errors compound each other so that they yield fatal results. In the last section, we showed how easy it is to accidentally delete a file with rm. But you probably wouldn’t realize how easy it is to delete a file without even using the rm command. To Delete Your File, Try the Compiler Some versions of cc frequently bite undergraduates by deleting previous output files before checking for obvious input problems. Date: Thu, 26 Nov 1992 16:01:55 GMT From: tk@dcs.ed.ac.uk (Tommy Kelly) Subject: HELP! Newsgroups: cs.questions9 Organization: Lab for the Foundations of Computer Science, Edinburgh UK I just did: 8We are careful to say “a shell” rather than “the shell.” There is no standard shell in Unix. 9Forwarded to UNIX-HATERS by Paul Dourish, who adds “I suppose we should take it as a good sign that first-year undergraduates are being exposed so early in their career to the canonical examples of bad design practice.”
Previous Page Next Page