Bash function so you can just say install packageName regardless of apt or yum distro
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 | |
install(){ | |
isApt=`command -v apt-get` | |
isYum=`command -v yum` | |
package=$1 | |
if [ -n "$isApt" ]; then | |
apt-get -y install $package | |
elif [ -n "$isYum" ]; then | |
yum -y install $package | |
else | |
echo "Err: no path to apt-get or yum" >&2; | |
exit 1; | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment