If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > redirecting stdout to two files

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-11-05, 12:56
ykhazin ykhazin is offline
Registered User
 
Join Date: Jun 2005
Posts: 1
Wink 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.
Reply With Quote
  #2 (permalink)  
Old 10-12-05, 10:35
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Cool


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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On