September 11th, 2007
Yes
I was talking with one of my Unix administrator friends yesterday that had never heard of /usr/bin/yes before. I have to admit I was a little surprised at first, but when you think about it, /usr/bin/yes is hardly ever used these days. To a younger administrator used to having a -y
or -f
flag on commands that cause an “always answer yes” or “force the action” effect, why would one ever need a command like /usr/bin/yes?
For those that have never heard of /usr/bin/yes, it repeatedly outputs the letter ‘y’ followed by a newline. It used to be used to answer ‘y’ to questions posed by programs asking things like “should I proceed?” and “are you sure?” If such commands do not have a mode to force them to be non-interactive and you want them to just perform the task without question, /usr/bin/yes is your tool. Run ‘yes’ and pipe the output to the interrogative command! As always, be careful to not run something that could cause unknown harm when using this technique!