问一个关于软件包的问题!
时间:2004-04-09
来源:互联网
请问在slackware里如果查找某个库属于某个包呢?
比如要查找 libpop.so.0,在RH里只有用rpm -qf libpop.so.0就可以了,但在slackware里面应该怎样做呢?
比如要查找 libpop.so.0,在RH里只有用rpm -qf libpop.so.0就可以了,但在slackware里面应该怎样做呢?
作者: SunnyLhj 发布时间: 2004-04-09
whichpkg:
#!/bin/bash
# whichpkg - list the slackware package(s) which installed
# the given file or directory;
# syntax: whichpkg name [...]
#
# starts with strict tests: full match on file or directory;
# if nothing found, try full match on .new or in;
# if nothing found, try substring match;
# multiple arguments are handled recursively.
#
# copyright 2004 by William Hunt, all rights reserved.
# distributed under terms of the Gnu Public License, version 2 or later.
# master distribution at ftp://prv8.net/slackstuff/
DATA=/var/log/packages/*
[ "$1" = . ] || [ "$1" = .. ] && shift # skip if given
[ "${1:0:2}" = ./ ] && F=${1:2} || F=$1 # trim relative root if given
[ "${1:0:1}" = / ] && F=${1:1} # trim absolute root if given
[ -z $F ] && exit # argument required
x=$( grep ^$F$ ${DATA} )
[ -z "$x" ] && x=$( grep ^$F/$ ${DATA} )
[ -z "$x" ] && x=$( grep ^$F.new$ ${DATA} )
[ -z "$x" ] && x=$( grep ^$F.in$ ${DATA} )
[ -z "$x" ] && x=$( grep /$F/$ ${DATA} | grep -v ":.*:" )
[ -z "$x" ] && x=$( grep /$F.new$ ${DATA} | grep -v ":.*:" )
[ -z "$x" ] && x=$( grep /$F.in$ ${DATA} | grep -v ":.*:" )
[ -z "$x" ] && x=$( grep /$F$ ${DATA} | grep -v ":.*:" )
for a in $x ; do b=${a%:*} ; echo ${b##*/} ; done | uniq
shift ; $0 $* # recursion.
# tha-tha-tha-that's all, folks!
#!/bin/bash
# whichpkg - list the slackware package(s) which installed
# the given file or directory;
# syntax: whichpkg name [...]
#
# starts with strict tests: full match on file or directory;
# if nothing found, try full match on .new or in;
# if nothing found, try substring match;
# multiple arguments are handled recursively.
#
# copyright 2004 by William Hunt, all rights reserved.
# distributed under terms of the Gnu Public License, version 2 or later.
# master distribution at ftp://prv8.net/slackstuff/
DATA=/var/log/packages/*
[ "$1" = . ] || [ "$1" = .. ] && shift # skip if given
[ "${1:0:2}" = ./ ] && F=${1:2} || F=$1 # trim relative root if given
[ "${1:0:1}" = / ] && F=${1:1} # trim absolute root if given
[ -z $F ] && exit # argument required
x=$( grep ^$F$ ${DATA} )
[ -z "$x" ] && x=$( grep ^$F/$ ${DATA} )
[ -z "$x" ] && x=$( grep ^$F.new$ ${DATA} )
[ -z "$x" ] && x=$( grep ^$F.in$ ${DATA} )
[ -z "$x" ] && x=$( grep /$F/$ ${DATA} | grep -v ":.*:" )
[ -z "$x" ] && x=$( grep /$F.new$ ${DATA} | grep -v ":.*:" )
[ -z "$x" ] && x=$( grep /$F.in$ ${DATA} | grep -v ":.*:" )
[ -z "$x" ] && x=$( grep /$F$ ${DATA} | grep -v ":.*:" )
for a in $x ; do b=${a%:*} ; echo ${b##*/} ; done | uniq
shift ; $0 $* # recursion.
# tha-tha-tha-that's all, folks!
作者: terminator 发布时间: 2004-04-09
谢谢兄弟!
作者: SunnyLhj 发布时间: 2004-04-09
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28