Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2005

    Wink Unanswered: redirecting stdout to two files

    Hi folks,

    This is a question about sending script output (for clarity, Bourne shell) into two identical files. One file is a normal log, second is used to append debug messages so they are mixed with normal output.

    Suppose we use this way of redirecting (from inside the script):

    exec > logfile1 2>&1

    If I had a second log file I could use some debug messaging:

    echo Debug msg.... >> logfile2

    But I have a single log file... Any help with this?

    Another question is, once redirected with "exec", what is the proper way of closing the log file(s) before leaving the script run? Should I redirect output back to where it was before?

    Thanks in advance.

  2. #2
    Join Date
    Jun 2003
    West Palm Beach, FL


    man tee
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts