title: Escaping special character when SQL output to variable in shell script
body: <p>Trying to assign output from SQL query on an object containing special characters to a variable in shell script.</p>
  
  <p>Running directly on the database: </p>
  
  <pre><code>db2 -x 'select count(*) from &lt;SCHEMA&gt;."/BIC/TEST"'
  
        11000
  </code></pre>
  
  <p>Yet when I include this in script I need to use double quotes as I am using variables passed into the sql. Using single quotes </p>
  
  <pre><code>Output=$(db2 -x 'select count(*) from ${_SCHEMA}."/BIC/TEST"')
  
  echo -e "$Output"
  </code></pre>
  
  <p>Results in:</p>
  
  <pre><code>SQL20521N  Error occurred processing a conditional compilation directive near
  "_". Reason code="7".  SQLSTATE=428HV
  </code></pre>
  
  <p>When I use double quotes I hit: </p>
  
  <p>SQL0104N  An unexpected token "'/BIC/TEST'" was found following "ount(*)</p>
  
  <p>Tried to escape the double quotes using another set of double quotes:</p>
  
  <p>db2 -x 'select count(*) from ${_SCHEMA}.""/BIC/TEST""'</p>
  
  <p>But this doesn't seem to work in script. It works for tables where there is no special characters/requirement to encase in quotations.  </p>
  
  <p>Any help is appreciated. </p>