Server Fault is a question and answer site for system and network administrators. 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

Usually if we want to redirect script output to file we simply do

   /etc/ > file.debug.txt  


   /etc/ | tee –a  file.debug.txt  

But What I want is to add /etc/ > file.debug.txt inside the script , but I not sure if it possible and how?

so when I run just


I need that all standard output will write to file.debug.txt
so what I need to add in my script in order to do that?

share|improve this question
up vote 2 down vote accepted

simple write exec > file.debug.txt in the beginning.


share|improve this answer

Your Answer


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.