This is my first bash script. I am trying to learn scripting and needed an idea. This is the first idea I came up with. When I used to distro hop I had to reinstall everything. This helped me out once I got the first part working. Then I wanted to add if then else for more than just Debian distros.
#!/bin/bash #Script Name : app_install.sh #Author inflatus #Created 4 Sept 2015 #Version 0.4 #Description #This script will determine the distributon of Linux and use the appropriate package manager to install my core apps current_distro=`cat /etc/*-release | grep "^ID=" | grep -E -o "[a-z]\w+"` close_distro=`cat /etc/*-release | grep "^ID_LIKE=" | grep -E -o "[a-z]\w+"` echo "$current_distro" echo "$close_distro" if [ "$close_distro" = "debian" ]; then #Debian #Install my apps on a fresh install of a Debian based Linux echo "This script will install your apps after a fresh install" apt-get update && apt-get dist-upgrade -y apt-get install htop traceroute whois gparted curl nmap openvpn rsync iptraf openssh-client git gimp hexchat unison -y #Adding repositories echo "Adding the repos" add-apt-repository ppa:atareao/telegram -y add-apt-repository ppa:mumble/release -y add-apt-repository ppa:stebbins/handbrake-releases -y add-apt-repository ppa:maarten-baert/simplescreenrecorder -y add-apt-repository ppa:remmina-ppa-team/remmina-next -y add-apt-repository ppa:libreoffice/libreoffice-5-1 -y add-apt-repository ppa:wireshark-dev/stable -y apt-get update apt-get install telegram mumble handbrake simplescreenrecorder remmina remmina-plugin-rdp libfreerdp-plugins-standard libreoffice wireshark -y apt-get dist-upgrade -y #Time to clean echo "Alright, cleaning now." apt-get autoclean #Finished install echo "Finished." elif [ "$close_distro" != "debian" ]; then #Fedora #Install my apps on a fresh install of a Fedora based Linux echo "This script will install your apps after a fresh install" dnf check-update -y dnf update -y dnf install htop traceroute jwhois gparted curl nmap openvpn rsync iptraf openssh-clients git gimp mumble remmina-plugins-rdp wireshark hexchat -y dnf clean all #Time to clean echo "Alright, cleaning now." dnf clean all #Finished install echo "Finished." else echo "This is not for you." fi