[olug] Redirect to /dev/null

Daniel G. Linder dlinder at iprevolution.net
Wed Jul 9 21:16:59 UTC 2003


The first way is correct:
/usr/bin/script.ksh > /dev/null 2>&1

Basically you read it left to right:
Run "/usr/bin/script.ksh".  Send the "stdout" to /dev/null.  Send the
"stderr" to "stdout".  You can be more precise and type this:

/usr/bin/script.ksh 1>/dev/null 2>/dev/null

In this example "stdout" (the "1") is implicitly directed to /dev/null,
and "stderr" (the "2") is also implicitly directed to /dev/null.

If you want to send both output to separate files, then you could do
this:

/usr/bin/script.ksh 1>/tmp/output 2>/tmp/errors

Dan

> -----Original Message-----
> From: Joe Catanzaro [mailto:joecatanzaro at cox.net] 
> Sent: Wednesday, July 09, 2003 9:13 AM
> To: olug at olug.org
> Subject: [olug] Redirect to /dev/null
> 
> 
> OK, to redirect crap to /dev/null, is it      /usr/bin/script.ksh > 
> /dev/null 2>&1    or is it     /usr/bin/script.ksh > 2>&1 /dev/null
> 
> 
> Thanks,
> 
> 
> 
> 
> Joe Catanzaro
> joecatanzaro at cox.net 
> 
> 


More information about the OLUG mailing list