the "yes" comand

Bill Campbell freebsd at
Wed Mar 4 16:17:49 PST 2009

On Thu, Mar 05, 2009, Vasadi I. Claudiu Florin wrote:
> Hell-o,
> Ever wondered about the "yes" command? Well, I have. If one does "yes"  
> into a terminal one get's an infinit output of "y" on a new line each  
> time. What's the deal here?

The ``yes'' command is designed to automate interactive scripts
that expect a repetitive string typed manually (e.g. something
like fsck but without the ``-y'' option).  One would use
something like:

yes | somecommand

It takes a single string argument so if you had a program that
always expected the string ``greblefarf'' one could use:

yes greblefarf | yourcommand

> I saw the same thing on linux, but you only had to type "y" (those cheap  
> blokes :P)

I don't know what you're talking about here.  To the best of my
knowledge, the yes command works the same on every version of
*nix I have used which goes as far back as Radio Shack Xenix in
1982 (the last real OS that Microsoft was responsible for :-).

INTERNET:   bill at  Bill Campbell; Celestial Software LLC
URL:  PO Box 820; 6641 E. Mercer Way
Voice:          (206) 236-1676  Mercer Island, WA 98040-0820
Fax:            (206) 232-9186

The pinnacle of open systems is: when moving from vendor to vendor, the
design flaws stay the same.

More information about the freebsd-questions mailing list