热门关键字:  ubuntu  分区  函数  Fedora  linux系统进程

当前位置 :| 主页>Linux教程>Shell开发>

一个小脚本,帮助你清除无用的rpm包

来源: 作者: 时间:2007-02-15 Tag: 点击:

 有时候,一个服务器上安装了某些你觉得毫无用处的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


最新评论共有 4 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册