title: Storing the output into shell variable
body: <p>I wish to store the Output of the following command over my postgres database</p>
  
  <blockquote>
    <p><strong>sudo -u postgres -H -- psql -d firstdb -c"select count(col2) from
    table2;"</strong></p>
  </blockquote>
  
  <p>into a variable defined in shell.
  I saw this way somewhere-</p>
  
  <blockquote>
    <p><strong>abc=sudo -u postgres -H -- psql -d firstdb -c"select count(col2) from
    table2;"
    echo abc</strong></p>
  </blockquote>
  
  <p>but seems to be not working 
  Is there any other way to store the output so as to apply cut query to fetch the value and check for the size of column??</p>