谢谢大家的回复,今天我写出来了,和2楼的思路是一个方向,我只要返回成功的,不成功的抛出去,我把关键代码写出来
VALUE=`sqlplus -S test/test@${ip}:1521/orcl <<EOF
set heading off feedback off pagesize 0 verify off echo off numwidth 4
select count(1) from dual;
exit
EOF`
if [ $VALUE -eq 1 ];then
echo “用户test能登陆主机为${ip}的数据库服务器;"
else
echo ”用户test不能登陆“
fi