Results 1 to 3 of 3

Thread: Pipe

  1. #1
    Join Date
    Nov 2003
    Posts
    6

    Unanswered: 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

  2. #2
    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

  3. #3
    Join Date
    Nov 2003
    Posts
    6

    Thumbs up Great :-)

    Thanks a lot, this works!

Posting Permissions

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