DEV Community

redhcp
redhcp

Posted on

3 3 1

Bash Script Menu Install Apps

In this script you will be able to visualize how to generate a menu in BASH to install applications for example.

for more info - https://github.com/redhcp/post-install

#!/bin/bash


function app_chrome() {
    #CHROME
    cd /home/
    sudo wget https://dl.google.com/linux/linux_signing_key.pub
    sudo wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
    sudo dpkg -i google-chrome-stable_current_amd64.deb
    sudo apt-get install -f
    sudo rm -f google-chrome*.deb
    sudo rm -f *signing_key.pub
    echo -e "\e[44m_____End Chrome_____\e[0m"
}

function app_slack() {
    #SLACK
    cd /home/
    sudo wget https://downloads.slack-edge.com/linux_releases/slack-desktop-4.12.2-amd64.deb
    sudo dpkg -i slack-desktop-*.deb
    sudo rm -f slack*.deb
    echo -e "\e[44m_____End Slack_____\e[0m"
}

function app_zoom() {
    #ZOOM
    cd /home/
    sudo wget https://zoom.us/client/latest/zoom_amd64.deb
    sudo dpkg -i zoom*.deb
    sudo rm -f zoom*.deb
    echo -e "\e[44m_____End Zoom_____\e[0m"
}

function app_git() {
    sudo add-apt-repository -y ppa:git-core/ppa 
    sudo apt update; sudo apt install -y git
    echo -e "\e[44m_____End Git_____\e[0m"
}

function update_system() {
    sudo apt update -y  && sudo apt upgrade -y && sudo apt autoremove -y
}

function all() {
    app_chrome
    app_slack
    app_zoom 
    app_git
    update_system
    echo -e "\e[44m_____End ALL\e[0m"
}

menu(){
echo -ne "
**OPTIONS**
2) Install Zoom 
3) Update_system
4) Install Chrome
5) Install Slack
6) Install Git

1) --ALL--
0) Exit

Choose an option:"
        read a
        case $a in
            1) all ; menu ;;               
            2) app_zoom ; menu ;;
            3) update_system ; menu ;;
            4) app_chrome ; menu ;;            
            5) app_slack ; menu ;;
            6) app_git ; menu ;;



        0) exit 0 ;;
        *) echo -e $red"Wrong option."$clear; WrongCommand;;
        esac
}

# Call the menu function
menu

Enter fullscreen mode Exit fullscreen mode

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay