BASH: check if a package is installed [Debian/Ubuntu]

Example: checks if the packages in the variable pks are installed. If not, update and install without prompt