title: result of php loop not passing to shell script
body: <p>I have a small foreach loop in php but the results will not pass to a shell script. see below:</p>
  
  <pre><code>$contents = file("$target_dir/$user.temp.txt");
  
  foreach($contents as $line) {
      echo $line . "&lt;br /&gt;";
      exec("sh read.sh $line &gt;&gt; tempfile");
  }
  </code></pre>
  
  <p>the echo statement works just fine and displays the data to screen as it should. however the result of $line does not make it to the shell script, but when I replace $line with a random string it does. here is the shell script:</p>
  
  <pre><code>#!/bin/bash
  #test script
  echo "test output: $1"
  </code></pre>
  
  <p>when trying to call the shell script with $line in place, the tempfile will get created but is blank. all my permissions are set to 777 and the group calling the script is the same owner as the folder. I've reviewed other posts about php loops but dont seem to find anything that matches exactly what my issue is.</p>
  
  <p>Thanks in advance for any insight.</p>