I looked at the TSCH man page, which said "Either output-file or error-file may be '/dev/tty' to send output to the terminal." So if I can redirect to two different locations, that would work. But calling, say,

(make foo > /dev/tty) > error.txt leaves me with an empty error.txt. As does make foo | tee error.txt.


You need to do:

 (command > stdout) >& stderr


 (make foo > /dev/tty) >& error.txt

The first > redirects the stdout to the tty, then the >& redirects whatever's left into error.txt.

In your case, it'd go like this:

~> (make foo > /dev/tty) >& error.txt
~> cat error.txt
make: *** No rule to make target `foo'.  Stop.

If you want to both display it, and write it to a file, |& is analogous to >&, i.e.:

~> ( python err.py > /dev/tty ) |& tee error.txt
This is stdout
This is stderr
~> cat error.txt
This is stderr

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.