The return status (also known as Exit Status of Exit Code) of a simple command is its exit status as provided by:
? is a special parameter that expands to the status of the most recently executed foreground pipeline.
echo $?
0
/usr/bin/somecommand || /bin/true
RESULT=$?
if [ ${RESULT} -ne 0 ];
then
echo -e "\nLast command has failed."
else
echo -e "\nLast command has succeeded."
fi
[ "$?" -eq 0 ] && echo success || echo failure