SQL Connection check though Scripting

Hi Guys,

I wanted to check the sql connection through scripting if it is avilable then proceed else stop the process

I was trying
sqlplus -L username/passwd@sid
if this is not sucess it gives non-zero.

but if it is success it is going into the sqlplus prompt.

So how could i get out of it and check the status.

try adding EOF
sqlplus -L username/passwd@sid << EOF > /dev/null
EOF

sorry it won't work.. it willl return status as 0 only...