[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [leafnode-list] making fetchnews quiet



* 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
-- 
_______________________________________________
leafnode-list mailing list
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
http://www.dt.e-technik.uni-dortmund.de/mailman/listinfo/leafnode-list
http://leafnode.sourceforge.net/