Can I include a php variable in shell_exec?
I’m tring to make this line work $Dname is a php variable
shell_exec(cat . $Dname.txt . | sed "s#,]}#]}#g" > $Dname2.txt);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You have not quoted your shell command, and you should escape
$Dnamewithescapeshellarg(). Note I have also escaped the quotes in thesedexpression, though in this case they could be changed to single quotes without negative effects.