Is there a way of running a script from sql plus and then finding the exit status.

Ie this normally works for most unix tools but not sqlplus for some reason.

sqlplus user/password < @test.sql
exit
EOF
EXITSTATUS=$?
if [ $EXITSTATUS != 0 ]
then
echo error
else
echo success
fi