find_rpm.sh內容如下
#!/bin/bash
[ $# -lt 1 ] && exit
p=$(which $1) && [ $? -ne 0 ] && exit
rpms=`rpm -qa` || exit
n=0
for i in $rpms
do
n=$[n + 1]
a=$(rpm -ql $i | grep "^$p\$")
[ "$a" != "" ] && echo $n $i $a && break
done
使用範例
find_rpm.sh which
RPM指令
rpm -q --whatprovides /
沒有留言:
張貼留言