Lets take this command for example:
$command = "echo '/just/for/the/test /heh/' | awk '//just// {print $1}'";
When directly copying it inside shell, I get the following error:
awk: cmd. line:1: //just// {print $1}
awk: cmd. line:1: ^ unterminated regexp
But, when I exec()
it, I get status code 1 with no output:
exec($command, $output, $status);
var_dump( $command, $output, $status );
// string(69) "echo '/just/for/the/test /heh/' | awk '//just// {print $1}'"
// array(0) { }
// int(1)
How to retrieve the STDERR part of exec?