Skip to content

Instantly share code, notes, and snippets.

@jasonbyrne
Created April 21, 2017 03:22
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jasonbyrne/65206e85087eda6988e6b12a6dbbeba2 to your computer and use it in GitHub Desktop.
Bash function so you can just say install packageName regardless of apt or yum distro
#!/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