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 > Pipe

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-27-03, 10:49
coredump coredump is offline
Registered User
 
Join Date: Nov 2003
Posts: 6
Pipe

Hi all!

Is it possible to redirect the error pipe from a programm to a file? "prog > log.txt" doens't work, some output goes to console. I think the messages that occur will go into a other pipe (error-pipe?)...

Thank you!
Greetings
Reply With Quote
  #2 (permalink)  
Old 11-27-03, 12:20
Damian Ibbotson Damian Ibbotson is offline
Padawan
 
Join Date: Jun 2002
Location: UK
Posts: 525
'prog > log' would more accurately be written as 'prog 1> log' as it is redirecting the standard output, which is assigned to file descriptor 1, to a file called log. Standard error is associated with file descriptor 2, so to redirect it use 'prog 2> errLog'.

Putting this together you could do something like...

prog 1> standardOutputLog 2> standardErrorLog

or maybe send them both to the same file...

prog 2> tmp 1>&2 (or prog 1> tmp 2>&1)

You might find this link useful:

http://duplex.hypermart.net/books/bsd/265-267.html
Reply With Quote
  #3 (permalink)  
Old 11-28-03, 02:54
coredump coredump is offline
Registered User
 
Join Date: Nov 2003
Posts: 6
Thumbs up Great :-)

Thanks a lot, this works!
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