I am relatively new to Linux in general, still learning :)
I want to write a bash script for automation of apt update
and apt upgrade
. I have the idea of sending the apt update
command, then watching the lines for specific words.
E.g, after apt update
was done, it says:
Reading state information... Done
89 packages can be upgraded.
So in this case I want to look for can be upgraded
. If those words are in the output the script shall execute apt upgrade -y
.
Any help is highly appreciated. Thanks in advance.