#! /bin/bash
if which gnupg >/dev/null; then
echo "Installed"
else
echo "Not installed" #If not installed
echo "Installing..."
sudo apt-get install gnupg #installation
fi
Do you have any idea? when i run this, it shows that is not installed but it tries to update it. And as a result it says : gnupg is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 46 not upgraded.
You have to look for gpg
(the actual executable name), not gnupg
(the package name). This should solve the problem.
if which gpg >/dev/null; then
echo "Installed"
# ...
fi
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With