Re: help executing shell commands
| From: | Fernando Serto | Date: | Tue, 06 May 2003 07:54:57 +0000 |
| Subject: | Re: help executing shell commands | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146494@lists.php.net to get a copy of this message | ||
thanks for your help mike!
I read the documentation regarding explode and implode, and couldn't find out how "eliminate" the last line of my output...
$ls =
ls /;
$pieces = explode("\n", $ls);
echo "<pre>";
foreach ($pieces as $value) {
echo " => $value\n";} echo "</pre>"; output: ... ... => usr => var => www => it's an empty line. best regards, Fernando Mike wrote:
$pieces = explode("\n", $test); echo "<pre>"; foreach ($pieces as $value) { echo "add something here => $value"; } echo "</pre>"; Ought to work... -Michael On Mon, 2003-05-05 at 23:15, Fernando Serto wrote:hi folks, I was trying to figure out how to describe my problem, but I couldn't, so, I decided to show "In Examples Given". I'm doing this: <?php $test =ls /root/; echo "<pre>add something here => $test</pre>"; ?> and the output: add something here => amanda-2.4.4.tar.gz anaconda-ks.cfg bcrypt BestCrypt-1.2-2.src.rpm BestCrypt-1.2-2.tar.gz cfs-1.3.3bf-11.src.rpm cfs.1.4.0.beta2.tar.gz cryptoapi-0.1.0 how can I have an output like this: add something here => amanda-2.4.4.tar.gz add something here => anaconda-ks.cfg add something here => bcrypt add something here => BestCrypt-1.2-2.src.rpm add something here => BestCrypt-1.2-2.tar.gz add something here => cfs-1.3.3bf-11.src.rpm add something here => cfs.1.4.0.beta2.tar.gz add something here => cryptoapi-0.1.0 Thanks in advance! Regards, Fernando