how to verify sqlplus not installed on solaris

i want to write shell script that exit by displaying error if sqlplus is not installed.

The platform is oracle10g on solaris sparc.

I tried the which sqlplus command, but it returns errorcode 0 even sqlplus is not installed.

Kindly help?

Hi! Can you post your script here?

It is below:

which $ORACLE_HOME/bin/sqlplus > /dev/null 2> /dev/null

if [ $? != 0 ]; then
echo "ERROR: Either sqlplus is not available on this machine or ORACLE_HOME is configured wrongly in install.sh"
exit 1
fi

filename="$ORACLE_HOME/bin/sqlplus"
if [ -s $filename ]
then
echo "YES. sqlplus available"
else
echo "NO sqlplus not avail"
fi