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