Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

#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
 
PREVIOUS NEXT
Tagged: #apt #stable #CLI #Use #caution
ADD COMMENT
Topic
Name
7+1 =