标签:
package.sh
#!/bin/bash for i in `cat $1` do echo $i >> result dpkg -l | grep $i | sed -n 1p > tmp //awk读出第五列以后的所有数据 awk ‘{for(i=5;i<=NF;i++) printf("%s ",$i);print ""}‘ tmp >> result //将脚本的错误内容重定向到文件中 sudo dpkg --purge $i >> result 2&1 if [$? == 0] then echo "无包依赖" >>result fi echo "----------------------------------------------" >> result done echo "to the end " exit 0
hello.c
glibc
libxml
...
执行脚本:
sudo bash package.sh hello
输出结果:
包名
包的作用
包的依赖关系
推荐
http://coolshell.cn/?s=shell
标签:
原文地址:http://my.oschina.net/u/2496664/blog/523714