megabyte78
asked on
how to handle error in bash scripting in unix
hi,
How do i handle an error if for example, i cannot connect to database in bash scripting in unix.
pls help!
How do i handle an error if for example, i cannot connect to database in bash scripting in unix.
pls help!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
what ahoffmann mean is:
sqlplus -s /nolog
if [ $? -ne 0 ] ; then
echo error occured
fi
# $? is the return value of your last command
you can do something like the following:
if sqlplus -s /nolog ; then
echo "ok !"
else
echo "error occured"
fi
sqlplus -s /nolog
if [ $? -ne 0 ] ; then
echo error occured
fi
# $? is the return value of your last command
you can do something like the following:
if sqlplus -s /nolog ; then
echo "ok !"
else
echo "error occured"
fi
ASKER
if [ sqlplus -s /nolog != 0]; then
echo error occured
fi