Re: How do I get output from exec() but not error messages?
| From: | Jason Wong | Date: | Tue, 06 May 2003 20:09:20 +0000 |
| Subject: | Re: How do I get output from exec() but not error messages? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146565@lists.php.net to get a copy of this message | ||
On Tuesday 06 May 2003 10:49, Daevid Vincent wrote:
> 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.
With bash one can redirect the 'standard error' (ie error messages) to some
other place. Thus you can use something like:
ifconfig eth7 2> /dev/null
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
It takes a special kind of courage to face what we all have to face.
*/