Share your alias AND/OR function

Here’s a couple of little goodies, adapted into functions for those interested in an easy way to check on updates without waiting for a notifier… you could even say it’s a “notify on demand”! One of them safely produces a COUNT of pending updates (both repo and AUR) - and the other actually lists them.

Update count
# Function to count available updates

upcnt() {
# create vars
NEWPKG=0
NEWAUR=0

# count AUR and pacman updates
NEWAUR=`yay -Qua | wc -l`
NEWPKG=`checkupdates | wc -l`

# output RESULT
if [[ ${NEWPKG} == 0 && ${NEWAUR} == 0 ]]; then
	RESULT="System up-to-date"
else
	RESULT=$NEWPKG" Repo pkgs + "$NEWAUR" AUR pkgs need updating"
fi
echo $RESULT
}
Updates list
# Function to list available updates

upls() {
# create vars
NEWAUR=0

# count AUR updates
NEWAUR=`yay -Qua | wc -l`

# run checkupdatesext to create file in /tmp
checkupdatesext > /tmp/update-list
if [[ ${NEWAUR} > 0 ]]; then
		echo " " >> /tmp/update-list
		echo "AUR Packages" >> /tmp/update-list
		echo "------------" >> /tmp/update-list
		yay -Qua | column -t -N Name,Current,"->",New >> /tmp/update-list
fi

# output RESULT
if [[ -s /tmp/update-list ]]; then
	cat /tmp/update-list
	rm /tmp/update-list
else
	echo "No pending updates..."
fi
}

Just paste either or both of these into your .bashrc (or other appropriate place) and once it has been sourced they are available for your enjoyment.

Note: these are written to be understood and to work - not to be stylish or minimalistic!