1

I would like to test the execution of a php script that redirect its stdout and stderr to a file with tee.

php /path/to/script --param 2>&1 | tee -a  /path/to/log
if ( test $? -ne 0 ); then
    exit 2
fi

The last code tests the execution of the tee -a even if the php ocmmand fails.

How can I exploit $? or something similar to test the php script not the whole line ?

4m1nh4j1
  • 1,873
  • 9
  • 29
  • 41

0 Answers0