Skip to content

Instantly share code, notes, and snippets.

@nik-gnomic
Last active September 11, 2023 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nik-gnomic/b67a754f3deff520b818734f65e1e692 to your computer and use it in GitHub Desktop.
Save nik-gnomic/b67a754f3deff520b818734f65e1e692 to your computer and use it in GitHub Desktop.
BASH script to find .pacnew files to merge in meld
#!/bin/bash
## ~/.local/bin/pacmerge
## Merge *.pacnew files with original configuration files
## requires pacdiff and meld
if [[ $(/usr/bin/pacdiff -o | /usr/bin/grep -e pacnew | /usr/bin/wc -l) -gt 0 ]]; then
echo ".pacnew files found"
# launch meld to merge file
for i in $(/usr/bin/pacdiff -o | grep -e pacnew); do
echo "Launching meld to merge $i ";
sleep 1
/usr/bin/meld "admin://${i/.pacnew/}" "admin://$i"
# request deletion of .pacnew file
read -p " Delete $i? " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo
sudo rm "$i"
echo " $i deleted"
else
echo
fi
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment