note 109693 added to function.shell-exec
| From: | wally at soggysoftware dot co dot uk | Date: | Fri, 10 Aug 2012 11:40:02 +0000 |
| Subject: | note 109693 added to function.shell-exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-189981@lists.php.net to get a copy of this message | ||
As others have noted, shell_exec and the backtick operator (`) both return NULL if the executed
command doesn't output anything.
This can be worked around by doing anything like the following:
shell_exec ("silentcmd && echo ' '");
Here we're simply outputting blank whitespace if the command succeeds - which satisfies this
slightly strange issue. From there, you can trim() the command output etc.
----
Server IP: 69.147.83.197
Probable Submitter: 194.72.68.66
----
Manual Page -- http://www.php.net/manual/en/function.shell-exec.php
Edit -- https://master.php.net/note/edit/109693
Del: integrated -- https://master.php.net/note/delete/109693/integrated
Del: useless -- https://master.php.net/note/delete/109693/useless
Del: bad code -- https://master.php.net/note/delete/109693/bad+code
Del: spam -- https://master.php.net/note/delete/109693/spam
Del: non-english -- https://master.php.net/note/delete/109693/non-english
Del: in docs -- https://master.php.net/note/delete/109693/in+docs
Del: other reasons-- https://master.php.net/note/delete/109693
Reject -- https://master.php.net/note/reject/109693
Search -- https://master.php.net/manage/user-notes.php