[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
> Now it's:
> >/dev/null 2>&1
> which I take it to mean move stdout to /dev/null and stderr to stdout
> Where am I getting it wrong?
Learn about Unix file descriptor semantics. I've used google for you:
(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?
leafnode-list mailing list