function is_deb { command_exists apt-get } function is_mac { [[ $(uname) == 'Darwin' ]] } function is_linux { [[ $(uname) == 'Linux' ]] } if is_mac; then if command_exists brew; then function pkg_install() { brew install $1 } function pkg_remove() { brew remove $1 } function pkg_update() { brew update && brew upgrade } else function pkg_install() { echo_r "Homebrew not installed" exit 1 } function pkg_remove() { echo_r "Homebrew not installed" exit 1 } function pkg_update() { echo_r "Homebrew not installed" exit 1 } fi elif is_deb; then function pkg_install() { sudo apt-get -y install $1 } function pkg_remove() { sudo apt-get -y remove $1 } function pkg_update() { sudo apt-get update && sudo apt-get upgrade } fi # vim:set ft=zsh: