I want to make a function to check if the program or library is already installed.
Thats what I do now:
dpkg --status software-properties-common | grep -q not-installed
if [ $? -eq 0 ]; then
sudo apt-get install -y software-properties-common
fi
What I want:
isPackageNotInstalled() {???}
if [ $(isPackageNotInstalled 'software-properties-common') ]; then
sudo apt-get install -y software-properties-common
fi
any help would be greatly appreciated.
if PackageXYZisInstalled. Obviously YMMV.