shell_exec syntax error. running in terminal directly is ok
- by Alex
Having this command:
$command = "diff -bBdH --ignore-all-space <(echo 'hi') <(echo 'hi1')";
echo $command;
$result = shell_exec($command);
On the screen I see:
sh: 1: Syntax error: "(" unexpected
diff -bBdH --ignore-all-space <(echo 'hi') <(echo 'hi1')
If I copy-paste the second line from the console output into the terminal, the result would be correct. (Reproduced on another machine too).
I'm missing something dead simple here and can't see what it is.
besides, why is my output reversed?
I'm clearly echoing the command before executing it,
thus the syntax error of the shell should appear after the shell_exec