Ostrzeżenie: Apt nie ma stabilnego interfejsu CLI. Użyj ostrożności w skryptach.
#First, consider the meaning of the warning you're trying to hide.
#In theory, apt could change tomorrow to calling them "distributions" instead of "packages" (because it "does not have a stable CLI interface yet") and this would completely break your pipeline. A more likely change would be one which uses the word "packages" in multiple places, causing your pipeline to return extraneous information instead of only the package count you're looking for.
sudo apt update 2>/dev/null | grep packages | cut -d '.' -f 1
Azizul7m