Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I tried doing this:

yes > yes.txt

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

share|improve this question
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
@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
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

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
Have you actually tried this? ` yes ` will never finish, it'll just consume lots of memory! – Daniel Beck Dec 4 '11 at 9:01
@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
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
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
If this was true, you should have received a No space left on device error. – bwDraco 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .