Created
December 12, 2017 19:26
-
-
Save OAkyildiz/a43eb89efcad64943632d7d58e59bd14 to your computer and use it in GitHub Desktop.
#Redundant script to check & install packages. Testing line #11 was the only purpose behind this
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Redundant script to check packages. | |
PKG="$1" | |
if [ -z "$PKG" ]; then | |
echo "Package name is required!" | |
exit 128 | |
fi | |
# I actually wrote this script to test the line below | |
if apt -qq list $PKG 2>/dev/null | grep -q installed; then | |
echo "$PKG is already installed!" | |
else | |
echo -n "$PKG was not found! Install?: (y/N)" | |
read REPLY | |
if [ "$REPLY" == "y" ]; then | |
sudo apt-get install $PKG | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment