Linux and Unix yes command
The yes command is used to output "y", or whatever word you choose, forever.
The yes command outputs the same string, STRING, in a constant stream. If STRING is not specified, the word it repeats is "y".
yes can be used to do something very similar: if the output of yes is piped to a command, it will effectively answer "yes" to any confirmation prompts.
|--help||Display a help message, and exit.|
|--version||Display version information, and exit.|
yes | rm -i *.txt
Removes all files with the extension .txt from the current directory. Here, yes outputs a constant stream of "y" characters, and that output is piped to the rm -i command, which prompts for confirmation before deleting each file. The y characters from the yes command will respond "yes" to each prompt automatically.
yes n | rm -i *.txt
Here, the yes command outputs "n" in a constant stream to the rm -i command, answering "no" to all the same questions. Therefore, this command deletes no files.
echo — Output text.