I wrote one script it is showing wrong out but i wrote another script it is showing right out. I really don't know the difference.
first-script-showing mistake.
#!/bin/bash
echo "Counting the Databases"
countp1=`ps -ef |grep pmon |grep -v grep | wc -l`
echo $countp1
#countp=3
if [ $countp1 -eq 3 ]
then
echo "SUCCESSFULL"
else
echo "FAILED"
fi
#sh count-pmon-stats.sh
Counting the Databases
5
FAILED
# countp=`ps -ef |grep pmon |grep -v grep | wc -l`
echo $countp
3
small script working fine.
#!/bin/bash
countp=`ps -ef |grep pmon |grep -v grep | wc -l`
if [ $countp -eq 3 ]
then
echo "ok"
else
echo "nok"
fi