Page 1 of 1
help using shell scripts as command line args
Posted: Mon Aug 25, 2003 3:32 pm
by twindu
I am building a functionality that takes in sheel script as command line args. In my logic i want to be able to open up a shell script which contains one line of code (comma delimitted commands) , read the line of code, and go into the proper function. I am basically converting perl code to php. Plese help.....thanks
Posted: Mon Aug 25, 2003 6:30 pm
by volka
can you explain in more details please?
Posted: Tue Aug 26, 2003 8:23 am
by twindu
my perl script gets a shell script posted to it. I am now trying to use the exec function....example:
$str=exec("bin/ship.sh");
print "<table cellpadding='10' cellspacing='10' border='1'>";
if(strlen($str)>1){
print"<tr><td bgcolor='#fff000'>present</td></tr>";
}else{
print"<tr><td bgcolor='#cc0000'>Not present</td></tr>";
}
print "</table> ";
exec doesnt seem to open the file and return anything...........i wanna know if there is a better way to execute a shell script using php.
Posted: Tue Aug 26, 2003 8:34 am
by Tubbietoeter
try shell_exec
Posted: Tue Aug 26, 2003 8:50 am
by twindu
I tried shell_exec....but i still dont get anything returned to me....I am now going to try preg_match to match an instance of the script as a reg expr.
Should i do this?....am i heading the right route?