I want to create a file from shell input. That is, I want to run some command, then type the desired contents of my file, then press Ctrl-D and have it create my file with the contents I typed in.

What would be the command for that?

link|improve this question

68% accept rate
Is this homework? – Zypher Oct 12 '11 at 0:27
No! I'm stuck for an hour at work because of this! But I'm happy to know it's easy enough to be considered homework! – Ram Rachum Oct 12 '11 at 0:28
feedback

1 Answer

up vote 3 down vote accepted

You use the cat command to concatenate STDIN to the file like so: cat >> out.txt (or to blow away the already existing file, don't append cat > out.txt) then type when done press ctl+d to terminate when you are done.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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