Return to Snippet

Revision: 40816
at February 8, 2011 11:19 by kenaniah


Initial Code
#!/bin/bash

#This script searches for .rpmnew files created by yum that are actually identical
#to their base file and removes them.
updatedb
FILES=$(locate .rpmnew)
for FILE in ${FILES}
do
        MD1=`echo $FILE | sed 's/.rpmnew//' | xargs md5sum | awk '{print $1}'`
        MD2=`md5sum $FILE | awk '{print $1}'`
        if [ $MD1 == $MD2 ]
        then
                echo "$FILE removed as it was identical"
                rm $FILE
        fi
done
updatedb

Initial URL


Initial Description


Initial Title
Removes .rpmnew files created by yum that are identical to their source

Initial Tags
Bash, script, linux

Initial Language
Bash