Exact error message in shell script with line number
<p>I have a shell script which has the following command :</p>

<pre><code>LOGFILE=XX`date +%Y-%m-%d-%H:%M:%S`.log
LOG_PATH=`echo $CUR_DIR/$LOG_FILE`

echo "Creating Custom Package, Synonyms and Grants..."
echo    ""&gt;&gt;$LOGFILE

if sqlplus $APPS_USER @Alter_table_script.sql
then
    echo "Custom table created successfully in APPS schema"     ""&gt;&gt;$LOGFILE
    echo "Custom table created successfully in APPS schema" 
else
    echo "Error in creating custom  table in APPS schema"     ""&gt;&gt;$LOGFILE
    echo "Error in creating Custom table  in APPS schema" 
fi
</code></pre>

<p>Alter_table_script is a sql file with alter and create statements. Now few of the statements have failed but in the log i do not have the exact errors and line captured instead it is showing <code>Custom table created successfully in APPS schema</code>  How do i capture the exact error in this file ?</p>