Pipe envsubst output to hive
<p>Working with Hive 0.13.0, I would like to evaluate variables against a template and then immediately execute the resulting Hive code (avoiding a temporary intermediate file is preferable).</p>

<p>Here is a (non-working) example of what I'd like to do:</p>

<p><strong>template.hql</strong></p>

<pre><code>SELECT COUNT(*) FROM ${TABLE};
</code></pre>

<p>In the shell:</p>

<pre><code>export TABLE=DEFAULT.FOOTABLE
envsubst &lt; template.hql | hive
</code></pre>

<p>Is there a particular reason this does not work, and is there a proper way to achieve it?</p>