Command output into any array?
| From: | Ken Jansons | Date: | Sat, 19 May 2001 17:51:27 +0000 |
| Subject: | Command output into any array? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-53536@lists.php.net to get a copy of this message | ||
Hello,
Is it possible to have the contents of a shell_exec command go into an array?
I have the following in my PHP script:
<?
$user="$PHP_AUTH_USER";
$command="command.sh";
$output=shell_exec("$command $user");
?>
Which calls a shell script "dirlist.sh", which returns results similar to the following:
www
www/docs
www/test
Is it possible to have each line put into an array? so that it would look like:
$results = array("www", "www/docs", "www/test");
The shell script has dynamic output, so the number of lines, and line content wouldn't be the
same on every execution.
I would like to use a foreach loop to put the output from the script into a form, so I am just
wondering if the command/array scenerio is possible.
Thank you for any help,
Ken Jansons
E-Mail: kenj@colinux.net