Linux运维盒纸

2017-10-04  本文已影响0人  Hu0buIk

rpm 批量删除软件包

#!/bin/sh
touch uninstall_list.txt
chmod u+x uninstall_list.txt
rpm -qa |grep $1 >uninstall_list.txt
func(){
i=0
while read line
do
     i=$(($i+1))
     echo "uninstall $i  : $line"
     #rpm -e --nodeps $line
done < uninstall_list.txt
return $i
}
func
read -p "[WARNING] drop $? package?[y/n]" resp
if [ $resp = "y" ];then
     #TODO删除操作
     echo "TODO"
else
     echo "these packages are not uninstalled"
fi

./mm运行

上一篇 下一篇

猜你喜欢

热点阅读