On Thu, 2002-06-06 at 20:04, The Gyzmo wrote:
> Why do you have to put '2>&1' after '/dev/null' when
> piping something to /dev/null, like this:?
> 
> [command] > /dev/null 2>&1

The "> /dev/null" redirects file descriptor 1 (stdout) to /dev/null.

The "2>&1" redirects file descriptor 2 (stderr) to file descriptor 1
(stdout, which was already redirected to /dev/null).

The combined effect is to redirect both stdout and stderr to /dev/null,
so that nothing goes to the terminal, unless the program itself does
something funny with the file descriptors (not likely).

Cheers,
-- 
Javier Gostling
Ingeniero de Sistemas
Virtualia S.A.
[EMAIL PROTECTED]
Fono: +56 (2) 202-6264 x 130
Fax: +56 (2) 342-8763

Av. Kennedy 5757, of 1502
Las Condes
Santiago
Chile



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to