Xapture Plsql Error from Unix Shell cript

Hi Friends,
Need your help . I have a shell script which executes the plsql procedure proc_p1.
I want to capture the error message when the procuder throws some error message.
I codeed in the following way . But it shows Job Success. Kindly anyone give some better idea to over come this

f_chk_err()
{
  if [[ $1 -ne 0 ]] then
     echo "Job Failed! $2 ... `date`"  >> ${TEMP_CTRL_ERR_FILE}
     
  fi
 if [[ $1 -eq 0 ]] then
     echo "Job Success! $2 ... `date`"  >> ${TEMP_CTRL_ERR_FILE}
     
  fi
}
######
# Main Program
######
sqlplus -s $LOGIN_ID_PW << EOF
exec s1.proc_p1(true);
EOF
f_chk_err $? Exec_aalcgp

Thanks
Ipsita

sqlplus -s $LOGIN_ID_PW << EOF
whenever SQLERROR exit 1
whenever OSERROR exit 1
exec s1.proc_p1(true);
EOF
f_chk_err $? Exec_aalcgp

Is that what you mean?

Thanks Jim . I am exactly need that . it works.