the title is quite self explanatory. I'm am writing a bash script that will manage all my packages (update, upgrade every upgrade-able apt and flatpak packages as well as removing the unneeded ones.
In one of the lines I'm using xargs to automatically run the upgrade command on every upgrade-able package without having to do a while loop. I'd like to echo a simple "No packages to upgrade" in the case where there's none.
I have tried this line but it didn't work
apt-get -s --no-download upgrade -V | grep '=>' | awk '{print $1}' | { sudo xargs --no-run-if-empty apt-get --only-upgrade upgrade -y } || { echo "No package to upgrade" }
Is there a way to run a "default" command in the case where xargs is empty ?