Search file in rpm shell script

I am new to shell script. I was taught this script can search files with in rpm packages. It seem nature to me somehow.
File name: searhrpm
#!/bin/bash

s=$1
shift

for f in $*

do
if (rpm -qlp $f 2>/dev/null | grep $s)
then
echo RPM: $f
fi
done
[root@rhel5 ~]# ./searchrpm "make" /misc/cd/Server/*.rpm

Comments

Popular posts from this blog

Openshift cert-manager integrate with ACME IdM on RHEL (Technical Preview)

TimeSync using ansible and rhel-system-roles.timesync

Remove HPE iLO license