Skip to content

Instantly share code, notes, and snippets.

Last active Feb 9, 2022
What would you like to do?
meldmerge - BASH script to find .pacnew files to merge in meld
## ~/.local/bin/meldemerge
## Merge new *.pacnew configuration files with the original .conf files
## requires pacdiff and meld
## use sudo to run script with root privileges
if [[ $(/usr/bin/pacdiff --output | wc -l) -gt 0 ]]; then
# show list of .pacnew files
echo ".pacnew files found: $(/usr/bin/pacdiff --output | wc -l)";
/usr/bin/pacdiff --output;
for i in $(/usr/bin/pacdiff --output); do
# create backup of .conf files to conf.old
echo "Creating backup file ${i/.pacnew/}.old";
/usr/bin/cp "${i/.pacnew/}" "${i/.pacnew/}.old"
# launch meld to merge file
echo -e "\nLaunch meld to merge changes from $i";
/usr/bin/meld "$i" "${i/.pacnew/}"
# request deletion of .pacnew file
while true; do
read -p "Delete $i? " Y
case $Y in
[Yy]* ) rm -v "$i"; \
break ;;
* ) break ;;
echo "no .pacnew files found";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment