title: Why a new line character appending to shell variable?
body: <p>I have used the method to assign the SQL output to a variable as below.</p>
  
  <pre><code>dbRole=$(${SQLPLUSPGM} -s / as sysdba &lt;&lt;-EOF
  set head off
  set verify off
  set feedback off
  select trim(translate(database_role,' ','_')) from v\$database;
  exit;
  EOF
  )
  </code></pre>
  
  <p>But the variable o/p appending a <code>"\n"</code> character i.e <code>\nPHYSICAL_STANDBY</code> </p>
  
  <p>However, when I use the below method it is working fine </p>
  
  <pre><code>${SQLPLUSPGM} -s / as sysdba &lt;&lt;-EOF | grep -v '^$' | read dbRole
  set head off
  set verify off
  set feedback off
  select trim(translate(database_role,' ','_')) from v\$database;
  exit;
  EOF
  </code></pre>
  
  <p>Any suggestion why it is appending `\n' and how we can get rid of it. </p>
  
  <p>Appreciate your suggestions. </p>