/yes

yes - Implementation of simple and dangerous yes command in various languages. :+1:

Primary LanguageShellMIT LicenseMIT

yes

About yes

The yes command is used to output y, or whatever word you choose, forever. 🔁

yes

Description

The yes command outputs the same string, STRING, in a constant stream. If STRING is not specified, the word it repeats is y. 🔁

yes dates back to a time before Unix commands included the "force" (-f) option, which for many commands is the same as answering "yes" to all prompts.

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.

yes Syntax

yes [STRING]...

yes Output

y
y
y
y
y
y
.
.
.

Dangerous yes

Redirecting output to a file

yes can be dangerous also. If you redirect the output stream of yes to a file, it will eat up your storage space. 💣

$ yes >> yes.txt
^Z

$ du -h yes.txt
1007M yes.txt

I ran the command only for 10 Seconds. And It consumed almost 1 GB. 💥

Nested yes

yes takes an argument and prints it infinitely. What if you take yes as argument itself. 💣

$ yes `yes`

You tell me what happens. 😜