I like to check whether several packages are installed or not on Debian/UbuntuHere is my attempt at a script to do this:query=`dpkg-query -W -f '${Status}'`ok=install okif ! [ `$query`  curl == $ok ] ;then apt-get -y -qq install curl >> /dev/null 2>&1fiThe 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.
Loop to check whether a Debian package is installed or not
bash;shell script;dpkg
You seem to be doing things in a needlessly complicated way. Why not justdpkg -l curl || apt-get -y -qq install curl > /dev/null 2>&1You did ask for a one-liner after all. Since, presumably, all you want is to know whether curl is available, you could also just dotype curl >/dev/null 2>&1 || apt-get -y -qq install curl