How can I take the output of a shell script and place it in a file on the command line?

link|improve this question
feedback

migrated from stackoverflow.com Oct 29 '09 at 14:37

This question came from our site for professional and enthusiast programmers.

2 Answers

# write to file
sh myscript > out.txt
# append to file
sh myscript >> out.txt
# write both output and stderr to file
sh myscript 2&1>> out.txt
link|improve this answer
feedback
$ ./foo >> myoutputfile.txt
link|improve this answer
feedback

Your Answer

 
or
required, but never shown