Simple Git & GitHub CLI Shell Scripts
at master 909 B view raw
1#!/bin/bash 2 3function install_git { 4 echo "${BOLD}Installing Git...${RESET}" 5 6 if command -v apt-get &>/dev/null; then 7 $SUDO apt-get update -y >/dev/null 2>&1 8 $SUDO apt-get install -y git >/dev/null 2>&1 9 elif command -v yum &>/dev/null; then 10 $SUDO yum update -y >/dev/null 2>&1 11 $SUDO yum install -y git >/dev/null 2>&1 12 elif command -v dnf &>/dev/null; then 13 $SUDO dnf update -y >/dev/null 2>&1 14 $SUDO dnf install -y git >/dev/null 2>&1 15 elif command -v pacman &>/dev/null; then 16 $SUDO pacman -Syu --noconfirm git >/dev/null 2>&1 17 elif command -v zypper &>/dev/null; then 18 $SUDO zypper update >/dev/null 2>&1 19 $SUDO zypper install -y git >/dev/null 2>&1 20 else 21 echo "No supported package manager found. Please install Git manually." 22 exit 1 23 fi 24} 25 26# Setup git if not installed 27function setup_git { 28 if ! git --version >/dev/null 2>&1; then 29 install_git 30 fi 31}