有时候,一个服务器上安装了某些你觉得毫无用处的rpm包,你想
删除吧,比如rpm -e XFree86,它会告诉你一堆软件包依赖于这个
rpm包,于是你不得不又去删除那些rpm包,下面这个脚本可以稍微
帮到你.
| 以下为引用的内容: #!/bin/sh #copyleft [email]lepton@ytht.net[/email] toe=$1 while true;do if rpm -e --test $toe;then echo $toe break else tmp=`rpm -e --test $toe 2>&1 |grep needed|sed -e 's/.* needed by \(.*\)/\1/'` toe=`echo $tmp $toe` echo $toe echo $toe fi done echo "These rpm will be removed." echo "$toe" echo $toe > al echo "Press any key to see the description about these rpm." read ans (for i in $toe;do echo $i;rpm -qi $i;echo "=======================";done)|more echo "Are you sure you want to erase all of these rpm?[Y/N]" read ans if [ $ans = "Y" -o $ans = "y" ];then rpm -e $toe else echo "You change your mind." fi |
