Example: checks if the packages in the variable pks are installed. If not, update and install without prompt
sh
#Packages
pks="root-tail xdm"
echo "Installing required packages if missed"
dpkg-query -l $pks
if [ "$?" != "0" ]
then apt-get update && apt-get -y install $pks
fi