Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

bash check if package is installed

REQUIRED_PKG="some-package"
PKG_OK=$(dpkg-query -W --showformat='${Status}
' $REQUIRED_PKG|grep "install ok installed")
echo Checking for $REQUIRED_PKG: $PKG_OK
if [ "" = "$PKG_OK" ]; then
  echo "No $REQUIRED_PKG. Setting up $REQUIRED_PKG."
  sudo apt-get --yes install $REQUIRED_PKG 
fi
Comment

PREVIOUS NEXT
Code Example
Shell :: clear cache manjaro 
Shell :: install vscode insiders ubuntu 
Shell :: linux invalid filename fix 
Shell :: powershell download a file from url 
Shell :: remove port binding windows 
Shell :: pip install import export django 
Shell :: install geopandas 
Shell :: show saved wifi password windows 11 
Shell :: install bower npm 
Shell :: bash curl forecast 
Shell :: run powershell command as administrator 
Shell :: install readline-sync 
Shell :: check if mongodb is running mac 
Shell :: airflow username password 
Shell :: ubuntu create archive split 
Shell :: update software in ubuntu 
Shell :: how to install chromedriver on linux 
Shell :: pycharm ubuntu download 
Shell :: dash bootstrap install 
Shell :: extract tar linux 
Shell :: arch ocamlfuse 
Shell :: Reset Gnome desktop settings to factory defaults 
Shell :: cypress install 
Shell :: how know linux version 
Shell :: how to uninstall zsh on mac 
Shell :: install pylatex no dependency 
Shell :: git reset fork 
Shell :: vs code always says rebasing git 
Shell :: install opencl library 
Shell :: how to send desktop notification in ubuntu 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =