RE: [PHP] executing shell commands.
| From: | IDS DM&DS) | Date: | Wed, 10 Sep 2003 16:56:25 +0000 |
| Subject: | RE: [PHP] executing shell commands. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-162200@lists.php.net to get a copy of this message | ||
This seems to do the trick -
$system = `/bin/ls /dcsa-ws1/share/webadm1/public_html/system-reports/security/rhosts/
eqty | /bin/egrep -v "server|header|index|report|php|old|title" | /bin/head -$x | /b
in/tail -1 | /bin/awk '{ print $1 }'` ;
$numlin = `/bin/wc -l /dcsa-ws1/share/webadm1/public_html/system-reports/security/rhos
ts/eqty/$system` ;
Thanks.
Samir.
-----Original Message-----
From: Curt Zirzow [mailto:php-general@zirzow.dyndns.org]
Sent: Wednesday, September 10, 2003 12:15 PM
To: 'php-general@lists.php.net'
Subject: Re: [PHP] executing shell commands.
* Thus wrote Sethi, Samir (IDS DM&DS) (samir_sethi@ml.com):
>
> I am executing the following within PHP -
>
> $system = `/bin/ls /dcsa-ws1/share/webadm1/public_html/system-reports/security/rhosts/eqty |
> /bin/egrep -v "server|header|index|report|php|old|title" | /bin/head -$x | /bin/tail
> -1 | /bin/awk '{ print $1 }'` ;
>
> $numlin =
/bin/cat
> /dcsa-ws1/share/webadm1/public_html/system-reports/security/rhosts/eqty/$system | /bin/wc
> -l ;
Any reason your cat'ing the file instead of just runing
/bin/wc -l file
also, what is the contents of $system? the backticks will expand
variables, my guess is that the first command isn't returning what
you expected.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php