What is the meaning of the coreutils yes program?

All he does is repeat the first argument again and again?

Is it just some bizarre Easter egg, or is there a use for it. The manual page is not well resolved.

+4
source share
5 answers

Some programs, for example. find (1) with the option -okor rm (1) with the option -i, etc .... ask yes / no questions. Some scripts may use these programs with these parameters.

Therefore, it is sometimes convenient to pass the output yesto these programs or scripts.

, , ( ) yes . , , .

, . .

+6

yes /
, , , : D

+2

: yes > /dev/sdaX , dd if=/dev/zero of=/dev/sdaX

. .

+1

.

| RM *.exe

0

"" ""

- :

yes | head -n10 > 10lines.txt
yes 0 | sed '1~2s/0/1/' # generate 1,0,1,0,... infinite clock
yes 'UUUUUUUUUUUUUUUUU' | tr -d '\n' > /dev/to/overwrite  # with alternating bits
0

All Articles