[Techtalk] Killing With Linux: A Primer

Val Henson val.henson at gmail.com
Thu Apr 27 07:39:26 EST 2006


On 4/25/06, Carla Schroder <carla at bratgrrl.com> wrote:
> On Tuesday 25 April 2006 8:15 pm, Val Henson wrote:
> > This is probably also too basic for Techtalk, but the origin of the
> > yes command is a funny story. Anyone feel like telling it?
>
> Well come on, someone must know this! I am dying of suspense.

I've held back for several reasons:

1. Inability to find documentation (translation: I could be wrong).
2. Hope that someone else knows more than me.
3. Perhaps "funny" is too strong a word. :)

So, back in the old days, some UNIX utilities wanted you to confirm
that you really wanted to do something before it would actually do it.
 This is fine, except that sometimes it would ask you, literally,
thousands of times, and, this being the old days, these commands
tended not to have some command line option for "assume yes." 
Usually, the way you indicate the "yes" answer is by typing 'y' and
then the Enter key.  Early UNIX admins would sometimes spend hours -
yes, hours - hitting 'y', enter, 'y', enter..

One of these annoying interactive applications is fsck, the file
system checker.  When it is repairing a file system, by default it
asks you to confirm many operations this way, because, you know, the
person running it is highly likely to be a file systems expert and
would be better off repairing the errors by hand.  Not.  One of the
implications of this design was that if a system crashed, you had to
run fsck before you could finish booting, and you might have to sit at
a console and type 'y', enter, hundreds of times before the system was
usable again.

So the "yes" command was invented.  By default, it outputs "y",
newline, "y", newline... You just hook this up to any annoying program
that wants lots and lots of user interaction and voila, you get to
rest your sore fingers while "yes" does the typing.

$ yes | fsck /dev/whatever
Deleted inode 180300 has zero dtime.  Fix? y
Directories count wrong for group #11 (17, counted=15).
Fix? y
[...]

But nowadays, most utilities (including fsck) are smart enough to
include a command line option that says "Do it all automatically,
don't bug me."

YOU COULD HOSE YOUR SYSTEM WARNING: Don't go off and run any of these
commands just for the fun of it; usually programs ask these questions
for a good reason - because you might not want it do what it's about
to do.

I hope that was mildly entertaining, if not actually funny.

-VAL


More information about the Techtalk mailing list