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

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

share|improve this question

migrated from Oct 29 '09 at 14:37

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

# 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
share|improve this answer
$ ./foo >> myoutputfile.txt
share|improve this answer

You must log in to answer this question.