Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added pkgs number for distros that use apt #1

Merged
merged 3 commits into from
Nov 20, 2021
Merged

Added pkgs number for distros that use apt #1

merged 3 commits into from
Nov 20, 2021

Conversation

SimoneSalzano
Copy link
Collaborator

@SimoneSalzano SimoneSalzano commented Nov 20, 2021

By storing OS name in a variable, we can use it to get the number of packages from the package manager corresponding to the chosen OS:

os=$(awk -F '"' '/PRETTY/ {print $2}' /etc/os-release)
pkgs=""
case $os in 
*"Ubuntu"*|*"Mint"*|*"Debian"*|*"Pop!_OS")
    pkgs=$(dpkg-query -l | grep "^ii" | wc -l)
    ;;
*"Arch"*)
    pkgs=$(pacman -Q | wc -l)
    ;;
esac

We can easily do this for other package managers by adding more cases.

@wick3dr0se wick3dr0se merged commit 2b2e0f2 into wick3dr0se:master Nov 20, 2021
@SimoneSalzano SimoneSalzano deleted the apt_pkgs_branch branch November 21, 2021 09:34
wick3dr0se pushed a commit that referenced this pull request Nov 23, 2021
catching up to master: 11.22.2021 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants