title: How get data back out of a (PHP) shell script
body: <p>I'm running a PHP script in a larger shell script by doing</p>
  
  <pre><code>php -f $filename &gt; `basename $filename .php`.html
  </code></pre>
  
  <p>Now I would like to let the script tell me which file extension to use for the output file name. I tried</p>
  
  <pre><code>export AW_FILENAME_SUFFIX=".html"
  php -f $filename &gt; `basename $filename .php`$AW_FILENAME_SUFFIX
  </code></pre>
  
  <p>and a <code>putenv("AW_FILENAME_SUFFIX=.txt")</code> in the script itself, but it seems that only changes the environment the PHP command and its subprocesses run in, not the one of the calling script.</p>
  
  <p>Is there another way to get data out of my script besides the output that I can use for metadata like that, or writing to a second file?</p>
  
  <p>I will run several scripts, which AFAIK means I can't really <code>source</code> them into mine, that might give me duplicate function errors.</p>