title: Check return status of psql command in unix shell scripting
body: <p>I am using psql command to connect and issue a query on postgreSQL database. Can anybody let me know how to check the return status of the executed query in shell script.</p>
  
  <p>I have used <code>echo $?</code> command to check the status but it always returning zero.</p>
  
  <p>Thanks for the help.</p>