Skip to content

Instantly share code, notes, and snippets.

@nathanchere
Last active May 30, 2017 12:39
Show Gist options
  • Save nathanchere/b3c65ff10b0b5aedb24c4e2cb5bfabe5 to your computer and use it in GitHub Desktop.
Save nathanchere/b3c65ff10b0b5aedb24c4e2cb5bfabe5 to your computer and use it in GitHub Desktop.
Check if a package is installed or not in Arch
#!/usr/bin/env bash
packageName="libssl"
pacman -Qi "$packageName" &> /dev/null
if [ $? -eq 0 ]; then
echo "Package '$packageName' is installed"
fi
if [ ! $? -eq 0 ]; then
echo "Package '$packageName' is not installed"
fi
#!/usr/bin/env bash
isPackageInstalled() {
pacman -Qi "$packageName" &> /dev/null
echo $?
}
if [ isPackageInstalled('stow') ]; then
echo 'Package is installed'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment