Subject: Re: Redirecting outputs
To: Dante Profeta <profeta@neomedia.it>
From: Brett Lymn <blymn@awadi.com.au>
List: netbsd-help
Date: 10/17/1996 19:31:18
According to Dante Profeta:
>
>How can I redirect stderr output as well as stdout to /dev/null?
>

use something like:

myprog > /dev/null 2>&1

The last bit makes the stderr file descriptor point at the same place
as stdout.

>system("myprog >/dev/null") redirects only the stdout...
>

try:

system("myprog > /dev/null 2>&1")

BTW I hope you understand that system is rather a dangerous call to
use in some situations (notably setuid binaries =:-O) because it just
execs /bin/sh to run the command you give it and hence is open to all
sorts of nasty hacker type attacks.  A whole load of these bugs were
cleaned out of Linux earlier this year.

-- 
Brett Lymn, Computer Systems Administrator, AWA Defence Industries
===============================================================================
  "Upgrading your memory gives you MORE RAM!" - ad in MacWAREHOUSE catalogue.