|
可以通过它来判断哪些包是冗余的,然后删掉
#!/bin/bash
#find packages on this OS
PKGS=`dpkg -l |sed -e '1,5d'|sed -e 's/^[a-z]*\s*\(\S*\)\s*.*/\1/g'`
reslist="[[[[[ $PKGS ]]]]"
echo $PKGS
echo "====begin===="
#if a package is depended on any package installed , remove it from the list
for pkg in $PKGS
do
echo $pkg
DEPS=`dpkg -s $pkg|grep Depends| sed -e 's/Depends: //g;s/([^)]*)//g;s/|/ /g;s/,/ /g;'`
for dep in $DEPS
do
reslist=`echo $reslist | sed -e "s/ $dep / /g"`
# echo $reslist
done
done
echo "====end===="
echo $reslist |
|