Quantcast
Channel: How to check if a package is installed from Bash? - Ask Ubuntu
Browsing all 4 articles
Browse latest View live

Answer by jarno for How to check if a package is installed from Bash?

To check, if package named 'pkgname' is successfully installed, use if dpkg-query -W -f'${db:Status-Abbrev}\n' pkgname 2>/dev/null \ | grep -q '^.i $'; then echo 'Installed' else echo 'Not...

View Article



Answer by Xen2050 for How to check if a package is installed from Bash?

If you know the exact package name, you can just ask dpkg if it's installed with dpkg -l packagename For example: $ dpkg -l pulsea dpkg-query: no packages found matching pulsea The exit code is also 1...

View Article

Answer by Romeo Ninov for How to check if a package is installed from Bash?

You can check if the software is installed on this way: if [ "$(dpkg -l | awk '/ansible/ {print }'|wc -l)" -ge 1 ]; then echo OK else echo FAIL fi You can't use exit code because it will be from awk...

View Article

How to check if a package is installed from Bash?

I need to check if a specific package is installed on a machine from within a Bash script. I found something like that but I don't know how use it correctly. dpkg -l | grep "ansible" | awk '{print...

View Article
Browsing all 4 articles
Browse latest View live




Latest Images