Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> just piping the compiler output to less or head also doesn't work, because the errors go to stderr

|& is your friend:

g++ foo.cc |& less



How did I not know this until now. Fantastic.


Or, if you want to save the output to a log file:

    g++ foo.cpp 2>&1 | tee ./log
or, the shorthand of 2>&1 |:

    g++ foo.cpp |& tee ./log


I like to do `g++ foo.cc |& tee /tmp/out` then you can `less /tmp/out`, grep the file, open it in an editor etc.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: