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
y y y ... ➜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 | some interactive command
When the interactive command terminates, so will yes
. Be careful with
this technique: you must be certain that every prompt should be
answered with the same string.
Get Macintosh Terminal Pocket Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.