Skip to content

Instantly share code, notes, and snippets.

@nichollsc81
Last active June 18, 2021 07:09
Show Gist options
  • Save nichollsc81/c2ad27a2d5d34d22520a9044d8056f16 to your computer and use it in GitHub Desktop.
Save nichollsc81/c2ad27a2d5d34d22520a9044d8056f16 to your computer and use it in GitHub Desktop.
#!/bin/bash
## declare array
declare -a REQUIRED_PKGS=("dnsutils" "nano")
# iterate over array
for i in "${REQUIRED_PKGS[@]}";
do
# if installed then remove
if [ "$(dpkg -l | grep $i)" ]; then
sudo apt-get purge --auto-remove ${i} -y #--simulate
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment