4 ms·
> 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
by usefulcat 2y ago
> 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
- imron 2y agoHow did I not know this until now. Fantastic.
- dmitris 2y agoI like to do `g++ foo.cc |& tee /tmp/out` then you can `less /tmp/out`, grep the file, open it in an editor etc.
- fransje26 2y agoOr, 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