title: How to store result from SQLPlus to a shell variable
body: <p>My requirement is to store the result of an sqlplus operation into a variable in my shell script.
  I need the result of the following operation which is in my .sh file</p>
  <pre><code>sqlplus 'user/pwd' @test.sql
  </code></pre>
  <p>I have already tried</p>
  <pre><code>testvar = 'sqlplus 'user/pwd'
  @test.sql'
  </code></pre>
  <p>but that doesn't work.</p>
  <h1>EDIT::</h1>
  <p>I changed it to</p>
  <pre><code>testvar=sqlplus foo/bar@SCHM @test.sql
  </code></pre>
  <p>and it says</p>
  <blockquote>
  <p><code>SQL*Plus:: not found [No such file or directory] </code></p>
  </blockquote>
  <p>I tried with</p>
  <pre><code>testvar=$(sqlplus foo/bar@SCHM
  @test.sql)
  </code></pre>
  <p>and it gives the same error.
  When I try without the variable assignment like below</p>
  <pre><code>sqlplus foo/bar@schm @test.sql
  </code></pre>
  <p>it works fine</p>