shell_exec syntax error. running in terminal directly is ok
Posted
by
Alex
on Stack Overflow
See other posts from Stack Overflow
or by Alex
Published on 2012-12-11T16:30:35Z
Indexed on
2012/12/11
17:03 UTC
Read the original article
Hit count: 190
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
© Stack Overflow or respective owner