Skip to content

Instantly share code, notes, and snippets.

@spy86
Created Apr 6, 2022
Embed
What would you like to do?
Simple bash script for upgrade
#!/bin/bash
TEXT_RESET='\e[0m'
TEXT_YELLOW='\e[0;33m'
TEXT_RED_B='\e[1;31m'
sudo apt-get update
echo -e $TEXT_YELLOW
echo 'APT update finished...'
echo -e $TEXT_RESET
echo -e $TEXT_YELLOW
echo 'See upgradable packages '
echo -e $TEXT_RESET
apt list --upgradable
echo -e $TEXT_YELLOW
read -p "Are you sure to start upgrade? " -n 1 -r
echo -e $TEXT_RESET
if [[ $REPLY =~ ^[Yy]$ ]]
then
sudo apt-get upgrade
echo -e $TEXT_YELLOW
echo 'APT upgrade finished...'
echo -e $TEXT_RESET
apt -y autoremove
echo -e $TEXT_YELLOW
echo 'APT autoremove finished...'
echo -e $TEXT_RESET
apt clean
echo -e $TEXT_YELLOW
echo 'APT clean finished...'
echo -e $TEXT_RESET
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment