I like to check whether several packages are installed or not on Debian/Ubuntu Here is my attempt at a script to do this:
query=`dpkg-query -W -f '${Status}'`
ok="install ok"
if ! [ `$query` curl == "$ok" ] ;then
apt-get -y -qq install curl >> /dev/null 2>&1
fi
The result is
Install: target Installed is not a directory
but it should be what you can see in the second variable. I have a headache, npw because I can't find out the right way to handle this.