v=$(mysql -u$user -p$pass -D $db -e "select count(*) from user;")判断 host 是否为0 就可以if [ $v -eq 0 ]then echo "NOT EXISTS"fi