How do I get output from exec() but not error messages?

From: Date: Tue, 06 May 2003 02:49:29 +0000
Subject: How do I get output from exec() but not error messages?
Groups: php.general 
Request: Send a blank email to php-general+get-146487@lists.php.net to get a copy of this message
I'm trying to grab this information, but sometimes a linux machine doesn't have an eth1, and so I get: [daevid=pts/4]7:43pm:{/www/test}> ./machine.php eth1: error fetching interface information: Device not found eth1: error fetching interface information: Device not found How can I supress error messages for either exec() or system() while still getting regular good output. Prefixing with @exec() or @system() DOES NOT work. I still get the error messages above displayed to the terminal. $temp = preg_split("/\s+/",exec("/sbin/ifconfig -a eth1 | /bin/grep HWaddr"), -1, PREG_SPLIT_NO_EMPTY); $sku_machine['MAC_addr_eth1'] = $temp[4]; $temp = preg_split("/[\s:]+/",exec("/sbin/ifconfig -a eth1 | /bin/grep \"inet addr:\""), -1, PREG_SPLIT_NO_EMPTY); $sku_machine['dot_quad_ip_eth1'] = $temp[2]; BTW, anyone know of a better way to get the MAC address and IP address of eth0 and eth1, or is this about as good as I'm gonna get?

« previous php.general (#146487) next »