package.sh
shell
#!/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.cbash
glibc
code
libxml
xml
...
it
执行脚本:class
sudo bash package.sh hello awk
输出结果:sed
包名
grep
包的做用
数据
包的依赖关系
推荐
http://coolshell.cn/?s=shell