Last active
March 29, 2021 08:00
-
-
Save GluTbl/063bdbdd406316dfdcbf9c87dc7dc2e2 to your computer and use it in GitHub Desktop.
[apt update and upgrade] #linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -ne 1 ] | |
then | |
echo "Invalid arguments" | |
exit | |
fi | |
re='^[0-9]+$' | |
if ! [[ $1 =~ $re ]] ; then | |
echo "Please pass a numerical argument!!!" | |
exit | |
fi | |
if [ $1 -eq 1 ] | |
then | |
echo "*****************UPDATING**********************" | |
sudo apt update -y | |
elif [ $1 -eq 2 ] | |
then | |
echo *"****************UPGRADING***********************" | |
sudo apt upgrade -y | |
elif [ $1 -eq 3 ] | |
then | |
echo "*****************UPDATE and UPGRADE**************" | |
printf "\n\nUPDATING\n\n\n\n\n" | |
sudo apt update -y && | |
printf "\n\nUPGRADING\n\n\n\n" | |
sudo apt upgrade -y | |
elif [ $1 -eq 4 ] | |
then | |
echo "*****************UPDATE and UPGRADE**************" | |
printf "\n\nUPDATING\n\n\n\n\n" | |
sudo apt update -y && | |
printf "\n\nUPGRADING\n\n\n\n" | |
sudo apt upgrade -y && | |
printf "\n\nAUTO REMOVING\n\n\n\n" | |
sudo apt autoremove -y | |
elif [ $1 -eq 5 ] | |
then | |
echo "*****************CLEAN and then UPDATE and UPGRADE**************" | |
printf "\n\nCLEANING\n" | |
sudo rm -r /var/lib/apt/lists/* && | |
sudo apt-get clean && | |
printf "\n\nUPDATING\n\n\n\n\n" | |
sudo apt update -y && | |
printf "\n\nUPGRADING\n\n\n\n" | |
sudo apt upgrade -y && | |
printf "\n\nAUTO REMOVING\n\n\n\n" | |
sudo apt autoremove -y | |
else | |
echo "Ooopssss......" | |
exit | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment