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