I have some script with STDOUT and STDERR output. By default, both STDOUT and STDERR goes to console:
./script.sh
I can redirect STDOUT to file, leaving STDERR output in console:
./script.sh > log.txt
I can redirect both STDOUT + STDERR to same file with no output in console:
./script.sh > log.txt 2>&1
I can have both STDOUT and STDERR in console and logfile simultaneously:
./script.sh 2>&1 | tee -a log.txt
I don't want to see STDOUT, but I want to see STDERR, and I have to save everything in logfile. How could I have STDERR in console + logfile, while STDOUT in logfile only? Something like (pseudo-code, doesn't work):
./script.sh > log.txt 2 > /dev/tty | tee -a log.txt