Re: Command output into any array?

From: Date: Sat, 19 May 2001 19:38:12 +0000
Subject: Re: Command output into any array?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-53540@lists.php.net to get a copy of this message
accually php allready has this command and you are so close to it :) <?php $user = $PHP_AUTH_USER; $command = 'command.sh'; exec("$command $user", $result); ?> -- Chris Lee lee@mediawaveonline.com ""Ken Jansons"" <kenj@colinux.net> wrote in message news:001d01c0e08c$54601480$526ab218@grdjctn1.co.home.com... 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

« previous php.general (#53540) next »