This content has been marked as final. Show 2 replies
$? is the return status of the last command. In your example, EXIT_CODE will always be 0, unless the echo command fails, which is never going to happen.
echo $RETVAL EXIT_CODE=$? if [ $EXIT_CODE = 0 ]
The $RETVAL variable simply contains the output or string returned by your sqlplus command. What you need to do is to check for content of the $RETVAL variable. What content is considered successful and what failure?
RETVAL=`sqlplus -s apps/apps@VIS <<EOF >>$LOG
In your case however, $RETVAL is always empty, because you redirect all output to $LOG. If you want to write the complete output of your sqlplus command to a log file, use the following after your sqlplus procedure. For example:
exit; EOF ` echo "$RETVAL" >> $LOG if [ `echo "$RETVAL" | grep FAILED` ]; then ....