By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,521 Members | 1,492 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,521 IT Pros & Developers. It's quick & easy.

php exec error

P: n/a
i cannot execute the exec command and pass varaible through it

exec('/secure/sed_repl.sh "route add -host $obj->host device $device2" "" ');

I have to execute it this way ...
exec('/secure/sed_repl.sh "this one" "this one to" ');

thanks
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
*** IronMonk wrote/escribió (17 Jun 2004 07:36:19 -0700):
i cannot execute the exec command and pass varaible through it

exec('/secure/sed_repl.sh "route add -host $obj->host device $device2" "" ');


If $obj and $device2 are PHP variables, they won't be parsed since they are
inside a string delimited by single quotes.

$foo='John';
echo '$foo'; // Prints $foo
echo "$foo"; // Prints John
--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Jul 17 '05 #2

P: n/a
IronMonk wrote:
i cannot execute the exec command and pass varaible through it

exec('/secure/sed_repl.sh "route add -host $obj->host device $device2" "" ');

I have to execute it this way ...
exec('/secure/sed_repl.sh "this one" "this one to" ');

thanks

create a sh script that does the route add and takes 3 input parameters,
$adddelete $obj and $device2

where $adddelete = "add" or "delete"

then

exec('/secure/sed_adddeletehost.sh $adddelete $obj $device2 "" ');

Michael Austin
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.