This simple command works fine if pasted in the terminal but in php it doesn't work.
for f in a b c d e; do echo ${f/a/p}; done; 2>&1
Terminal
p
b
c
d
e
Php
$command = "for f in a b c d e; do echo \${f/a/p}; done;";
$command .= " 2>&1";
echo shell_exec($command);
outputs nothing.
$command = "for f in a b c d e; do echo \$\{f/a/p\}; done;";
$command .= " 2>&1";
echo shell_exec($command);
output:
${f/a/p}
${f/a/p}
${f/a/p}
${f/a/p}
${f/a/p}
What's the problem??
Thanks