Using “rpm –qa ” command, we can find whether the package installed or not.
Below shell script use the command for determine the given string/name package rpm installed or not installed.
rpmcheck.sh
############
rpm -qa "*$1*" > r1
line_no=$( wc -l < r1 )
echo "$line_no"
if [ $line_no == 0 ]
then
echo "rpm not installed "
else
echo "rpm installed "
fi
Output:
[root@home linux]# ./rpmcheck.sh milton
0
rpm not installed
[root@home linux]# ./rpmcheck.sh boost
2
rpm installed
No comments:
Post a Comment