O'Reilly logo

Linux Pocket Guide, 2nd Edition by Daniel J. Barrett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

yes — stdin  stdout  - file  -- opt  --help  --version

Synopsis

yes [string]

The yes command prints the given string (or “y” by default) forever, one string per line.

$ yes again
again
again
again
...

Though it might seem useless at first glance, yes can be perfect for turning interactive commands into batch commands. Want to get rid of an annoying “Are you SURE you want to do that?” message? Pipe the output of yes into the input of the command to answer all those prompts:

$ yes | my_interactive_command

When my_interactive_command terminates, so will yes.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required