You are reading a single comment by @ottbot and its replies. Click here to read the full conversation.
  • Ok I have a program who's screen output I want to redirect to file. I've done this before and use

    $myprog.out>>out.txt 2>&1

    and for some reason this is not working. I test it with a another simple test program

    $myprog.test>>out.txt 2>&1

    and it works

    I run myprog.out and the output goes to screen as usual but redirecting it seems to fail! It was working and now seems to have stopped WTF is going on!

    You're redirecting STDERR to STDOUT with 2>&1.. maybe in the second case the program is writing to STDERR? Not sure what that would work..

    Anyway, I think this is that you want:

    myprog.out | tee out.txt

    tee takes STDOUT and redirects to a file. If you also need STDERR output you can do

    myprog.out 2>&1 | tee out.txt

About

Avatar for ottbot @ottbot started