Skip to content

Instantly share code, notes, and snippets.

@colematt
Created February 21, 2024 17:26
Show Gist options
  • Save colematt/fb8763ab5cf22e330659fb11ba35a50a to your computer and use it in GitHub Desktop.
Save colematt/fb8763ab5cf22e330659fb11ba35a50a to your computer and use it in GitHub Desktop.
[Determine if a package is installed] #apt #ubuntu
# Check to see if a package named ansible is installed
if [ "$(dpkg -l | awk '/ansible/ {print }'|wc -l)" -ge 1 ]; then
echo OK
else
echo FAIL
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment