美文网首页
Linux运维盒纸

Linux运维盒纸

作者: Hu0buIk | 来源:发表于2017-10-04 15:33 被阅读0次

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运行

相关文章

网友评论

      本文标题:Linux运维盒纸

      本文链接:https://www.haomeiwen.com/subject/ipiuextx.html