title: passing argument from shell script to hive script
body: <p>I've a concern which can be categorized in 2 ways:
  My requirement is of passing argument from shell script to hive script. 
  OR 
  within one shell script I should include variable's value in hive statement.</p>
  
  <p>I'll explain with an example for both:</p>
  
  <p>1) Passing argument from shell script to hiveQL-></p>
  
  <pre><code>My test Hive QL:
  select count(*) from demodb.demo_table limit ${hiveconf:num}
  </code></pre>
  
  <p>My test shell script:</p>
  
  <pre><code>cnt=1
  sh -c 'hive -hiveconf num=$cnt -f countTable.hql'
  </code></pre>
  
  <p>So basically I want to include the value of 'cnt' in the HQL, which is not happening in this case. I get the error as:</p>
  
  <pre><code>FAILED: ParseException line 2:0 mismatched input '&lt;EOF&gt;' expecting Number near 'limit' in limit clause
  </code></pre>
  
  <p>I'm sure the error means that the variable's value isn't getting passed on.</p>
  
  <p>2) Passing argument directly within the shell script-></p>
  
  <pre><code>cnt=1
  hive -e 'select count(*) from demodb.demo_table limit $cnt'
  </code></pre>
  
  <p>In both the above cases, I couldn't pass the argument value. Any ideas??</p>
  
  <p><em>PS: I know the query seems absurd of including the 'limit' in count but I have rephrased the problem I actually have. The requirement remains intact of passing the argument.</em></p>
  
  <p>Any ideas, anyone? </p>
  
  <p>Thanks in advance.</p>