How to simulate yes/No in Linux scripts/commands

In some situations when executing a command or a Linux shell script we may require some manual intervention. The yes command is simple built-in command which will help you remove this manual intervention stuff in your scripts.

The yes command is a cousin of echo command both print what we given. Only difference is echo will print only once, but yes will print until we intervene. Below are some examples which will come handy when simulating yes/no in scripts/commands Example 1: Simulate yes when using rm command. My rm command is aliased to ???rm -rf???, so for this example I am using rm -i for this example. Remove all files in my directory.