1 2 3 4 5 6 7 8 9 10 11
#!/bin/bash [ ! -f /etc/libretools.d/cleansystem ] && exit 1 packages=($(comm -23 <(pacman -Qq | sort) <(sort /etc/libretools.d/cleansystem))) echo "Removing: ${packages[@]}" sudo pacman --noconfirm -Rcs ${packages[@]} exit $?