Aug 202013
 

One of the most difficult task to do in tcsh is to  redirect the stdout and stderr into separated files. I’m not doing this very often, and because of this I always forget how to do it. Every time when I need to do such a thing I spend tens of minutes trying different combination and reading man/internet pages.

On other shells like bash it is straight forward: my_command > out.txt 2> err.txt  . Such a thing will not work in tcsh, but hey the things are not so complicated. You just have to do (my_command > out.txt ) >& err.txt . Even more, if you want to redirect only the stderr to a file , and want to see what is originally printed on stdout you can do like this: (my_command > /dev/tty ) >& err.txt

Hope that the trick is useful for other visitors who came to this page.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)