Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I tried doing this:

yes > yes.txt

Afterwards, yes.txt is created but is completely empty.

share|improve this question
1  
Cannot reproduce on OS X (BSD). Can you yes | cat -v > yes.txt, maybe your yes implementation yes somehow prevents writing into a file? –  Daniel Beck Dec 4 '11 at 8:58
    
Also, you want to ask this on StackOverflow, I think. –  tekknolagi Dec 4 '11 at 9:00
1  
@tekknolagi They'll just close it as off-topic. It's perfectly acceptable here. –  Daniel Beck Dec 4 '11 at 9:01
    
@DanielBeck okey doke –  tekknolagi Dec 4 '11 at 9:02
2  
The source code to GNU yes does not indicate special handling of output to files. Are you sure that e.g. your disk isn't already full? Have you canceled the command, so e.g. buffering of writes to disk is no longer an issue? –  Daniel Beck Dec 4 '11 at 10:49

3 Answers 3

you want to do

`yes` > yes.txt

Which will execute yes and write the output to yes.txt


Note: yes command outputs a line, 'y' by default, endlessly - the abovementioned process will consume memory, cpu, and disk space until there is no free memory, after which it gets terminated. You may have to terminate it manually.

share|improve this answer
2  
Have you actually tried this? ` yes ` will never finish, it'll just consume lots of memory! –  Daniel Beck Dec 4 '11 at 9:01
1  
@DanielBeck that's what he wants... I did try it, in fact. He never asked if it was advisable :P –  tekknolagi Dec 4 '11 at 9:02
    
@DanielBeck see @ ChrisNava's answer, and @ RazorStorm's reply –  tekknolagi Dec 4 '11 at 9:03
3  
please make sure you know what `` or $() does before using that. @Daniel is right that only thing it does is a big memory consumption and termination after there is no free memory any more. –  Cougar Dec 4 '11 at 10:02
1  
I agree with tekknolagi. If the OP wants to jump off a cliff, let it be. –  surfasb Dec 4 '11 at 15:32

your original solution yes > yes.txt should work ... although you could work around it like this

while true; do echo yes; done >> yes.txt
share|improve this answer
up vote 0 down vote accepted

I found the solution; my harddrive was full >.<

share|improve this answer
1  
If this was true, you should have received a No space left on device error. –  DragonLord Dec 4 '11 at 21:55
    
@Gryllida, remove some files and try again. at first I got a diskquota exceeded error while doing something else. I thought deleting the file would help, but the file didnt actually get deleted. –  Razor Storm Dec 5 '11 at 6:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.