Friday, September 9, 2011

Redirection of stdout and stderr

Some notes on redirection, this article has a good summary. I hold these patterns in my head, but had long since forgotten what the syntax actually meant. Send stdout and stderr to the same file:
./generatesomeoutput &> some_file
Send stderr to stdout:
./generatesomeoutput 2>&1
which is filedescriptor '2' (stderr) to file descriptor '1' (stdout), and the '&' indicates that '1' is a filedescriptor not a filename.

No comments: