PDA

View Full Version : The yes command, useless?



dragos240
March 9th, 2009, 01:41 AM
Okay, i was just looking through my /usr/bin and found the yes command, it's pretty funny, but looks pretty useless.... It just outputs y forever. Why was this created?

gletob
March 9th, 2009, 01:54 AM
someone should make a no command!

uknowho008
March 9th, 2009, 01:54 AM
my guess is that if your running a bunch of commands that you know you want run and you dont want to keep pressing y. just have the yes command do it for you??

dragos240
March 9th, 2009, 01:54 AM
someone should make a no command!

agreed.

RichardLinx
March 9th, 2009, 01:57 AM
You know when your installing new software and you have to keep answering questions y/n? ;) I assume that's what it could be used for anyway. Though I've never installed software where I had to say "y" (yes) more then about twice.

linuxisevolution
March 9th, 2009, 01:59 AM
I created an alias with bash that tells my computer to shut down if I type Die in terminal:


$> die
The system is going down for maintenance NOW!

Oh, and type sudo apt-get moo , and then type "yes actually I have"

And you will find the reason :D

yabbadabbadont
March 9th, 2009, 02:03 AM
someone should make a no command!


yes n

;)

init1
March 9th, 2009, 02:15 AM
It was for automatically affirming (y/n) prompts

Dougie187
March 9th, 2009, 02:24 AM
Very useful.

Imagine your program test requires a lot of user input for yes/no questions. So you do this.


yes | ./test

And now you don't have to answer any of the questions.

k2t0f12d
March 9th, 2009, 02:29 AM
The yes command outputs any specified string to stdin. By default the string output is "y" and "y" will be output if no other string is specified. To output any other string specify it after the yes command, i.e.
$ yes <string>

cariboo
March 9th, 2009, 02:33 AM
I'm surprised no one suggested looking at:


man yes


yes - output a string repeatedly until killed

Jim

zmjjmz
March 9th, 2009, 03:05 AM
It's also great for making sexual innuendos in bash.

CJ Master
March 9th, 2009, 03:20 AM
The yes command, useless?

Yes

MaxIBoy
March 9th, 2009, 03:23 AM
Warning, this is an extremely irritating fork bomb. It's harmless, but it will produce extreme slowness that will get worse and worse until the program is killed. (The command to stop it is "killall bash.")

You'll probably have to save it to a shell script file and run it, because it's two lines.

b=\' c=\\ a='yes $( echo b=$c$b c=$c$c a=$b$a$b; echo $a ) | bash &'
yes $( echo b=$c$b c=$c$c a=$b$a$b; echo $a ) | bash &Adapted from a BASH quine I found here: http://c2.com/cgi/wiki?QuineProgram

Dr Small
March 9th, 2009, 03:24 AM
Piping yes into fsck saved me a lot (and I mean, a lot) of keypresses one time ...

MaxIBoy
March 9th, 2009, 03:26 AM
If I'd known about "yes" that one time I was restoring from a backup with some scratched CDs, I wouldn't have had to leave some heavy weights on my "enter" key. :D

Dr Small
March 9th, 2009, 03:30 AM
If I'd known about "yes" that one time I was restoring from a backup with some scratched CDs, I wouldn't have had to leave some heavy weights on my "enter" key. :D
I never considered doing that, lol :D

yabbadabbadont
March 9th, 2009, 03:32 AM
I never considered doing that, lol :D

Many people just wedge it down with a paper clip.

MaxIBoy
March 9th, 2009, 03:37 AM
I stacked two dimes on the key, then I put a quarter on the dime, then I balanced a small dish on the quarter, then I put my cell phone in the dish.

It worked, too.

Then the program didn't need my input anymore, and the enter key started making it beep. :D

Dr Small
March 9th, 2009, 03:46 AM
Many people just wedge it down with a paper clip.
I have a huge ball bearing (which I use for a paperweight/desk ornament) on my desk, and it sits quite fine on my Return key. I shoulda thought of that and saved my finger, hand and key :)

MikeTheC
March 9th, 2009, 04:08 AM
someone should make a no command!

http://4.bp.blogspot.com/_9iMIweN5ntc/SW5W04ZYjwI/AAAAAAAAAM4/J_jQlvp8Ukk/s400/Yes+Bit+Recolor.jpg
Yes!!!

MaxIBoy
March 9th, 2009, 04:55 AM
http://design.osu.edu/carlson/history/images/tron-images/bitno.jpg

Nononononononononononononononononononono...