I'm trying to redirect error output to both a file and the terminal and throw away standard output, but I can't figure it out. Does anybody know how to do it?
myCommand 2>&1 1>/dev/null | tee /path/to/some/file.txt
STDOUT gets black-holed into /dev/null
STDERR gets redirected to STDOUT
tee receives STDOUT and re-echoes it as well as writing it to file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With