[leafnode-list] making fetchnews quiet

Ralf Wildenhues wildenhu at iam.uni-bonn.de
Wed Dec 1 10:41:35 CET 2004


* Hundri Magusin wrote on Wed, Dec 01, 2004 at 10:05:12AM CET:
> 
> >What you meant was >/dev/null 2>&1.  Order is important here.
> 
> Interesting.... but care to elaborate on this just for my curiosity sake? 
> The way I was understanding it was:
> 2>&1 >/dev/null
> 
> meaning assign stderr to stdout and then move stdout to /dev/null

Nope.

> Now it's:
> >/dev/null  2>&1
> 
> which I take it to mean move stdout to /dev/null and stderr to stdout

Nope.

> Where am I getting it wrong?

Learn about Unix file descriptor semantics.  I've used google for you:
http://www.faqs.org/docs/abs/HTML/io-redirection.html
http://www.ss64.com/bashsyntax/redirection.html
http://www.awprofessional.com/articles/article.asp?p=99706&seqNum=12
(sample from APUE; better even buy the book, it's worth it).

Basically, 2>&1 is just dup2(STDOUT_FILENO, STDERR_FILENO).

Forget the idea of 'moving' output anywhere.  All you do is duplicate
and redirect file descriptors.  Makes more sense now?

Regards,
Ralf



More information about the leafnode-list mailing list