Answering Terminal Prompts/Warnings Automatically

A quick tip for automating those terminal prompts or warnings that you may get while, for example, overwriting files during a ‘cp’ command, is to use the ‘yes‘ command which will “be repetitively affirmative”. Use it like this:

yes | cp -r foo/ bar/

The ‘yes’ command will output whatever you want forever as well. For example, if you wanted to say “no” to all prompts or warnings, you would simply use…

yes n | cp -r foo/ bar/

Feel free to donate if this post prevented any headaches! Another way to show your appreciation is to take a gander at these relative ads that you may be interested in:

There's 2 Comments So Far

Share your thoughts, leave a comment!