title: php calling bash problem
body: <p>I have this simple php script</p>
  
  <pre><code>&lt;?php
  echo '&lt;pre&gt;';
  
  // Outputs all the result of shellcommand "ls", and returns
  // the last output line into $last_line. Stores the return value
  // of the shell command in $retval.
  $last_line = $output = system ("~/public_html/cgi-bin/srch.sh &amp;&gt; ~/public_html/errors.txt",$retval);
  
  // Printing additional info
  echo '
  &lt;/pre&gt;
  &lt;hr /&gt;Last line of the output: ' . $last_line . '
  &lt;hr /&gt;Return value: ' . $retval;
  ?&gt;
  </code></pre>
  
  <p>Which relies on srch.sh:</p>
  
  <pre><code>#!/bin/bash
  
  for i in ~/mail/home/user/mail/domain.com/josh/cur/*
  do
  grep -i Value $i . &amp;&gt; ~/public_html/yesno.txt;
  done
  </code></pre>
  
  <p>However, all that is display in the b rowser is Retval 1, and no error gets recorded to either of the textfiles. Have I mixed stderr and stdout incorrectly, or missed something else?</p>