#!/bin/bash ACTION="$1" case $ACTION in remove) errpkg='' for pkg in jamulus do apt-get remove -y $pkg TEST=$( dpkg-query -s $pkg 2> /dev/null| grep Status | cut -d " " -f 4 ) if [ "$TEST" == 'installed' ];then errpkg="$errpkg $pkg" fi done if [ ${#errpkg} -gt 0 ] then exit 1 fi ;; esac