Update clean.sh

code refactoring
This commit is contained in:
tteckster 2023-09-13 11:48:21 -04:00 committed by GitHub
parent 14390c0e9e
commit 975bce31ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,14 +6,14 @@
# https://github.com/tteck/Proxmox/raw/main/LICENSE # https://github.com/tteck/Proxmox/raw/main/LICENSE
function header_info() { function header_info() {
clear clear
cat <<"EOF" cat <<"EOF"
________ __ _ ________ ________ __ _ ________
/ ____/ /__ ____ _____ / / | |/ / ____/ / ____/ /__ ____ _____ / / | |/ / ____/
/ / / / _ \/ __ `/ __ \ / / | / / / / / / _ \/ __ `/ __ \ / / | / /
/ /___/ / __/ /_/ / / / / / /___/ / /___ / /___/ / __/ /_/ / / / / / /___/ / /___
\____/_/\___/\__,_/_/ /_/ /_____/_/|_\____/ \____/_/\___/\__,_/_/ /_/ /_____/_/|_\____/
EOF EOF
} }
BL=$(echo "\033[36m") BL=$(echo "\033[36m")
@ -27,16 +27,10 @@ if [[ -z "$cache" ]]; then
echo -e "It appears there are no cached files on your system. \n" echo -e "It appears there are no cached files on your system. \n"
sleep 2 sleep 2
else else
echo -e "$cache \n" echo "Removing Cache"
echo -e "${GN}Cache in $name${CL}" find /var/cache -type f -delete
read -p "Would you like to remove the selected cache listed above? [y/N] " -n 1 -r echo "Successfully Removed Cache"
echo sleep 2
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Removing cache"
find /var/cache -type f -delete
echo "Successfully Removed cache"
sleep 2
fi
fi fi
header_info header_info
echo -e "${BL}[Info]${GN} Cleaning $name${CL} \n" echo -e "${BL}[Info]${GN} Cleaning $name${CL} \n"
@ -45,16 +39,10 @@ if [[ -z "$logs" ]]; then
echo -e "It appears there are no logs on your system. \n" echo -e "It appears there are no logs on your system. \n"
sleep 2 sleep 2
else else
echo -e "$logs \n" echo "Removing Logs"
echo -e "${GN}Logs in $name${CL}" find /var/log -type f -delete
read -p "Would you like to remove the selected logs listed above? [y/N] " -n 1 -r echo "Successfully Removed Logs"
echo sleep 2
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Removing logs"
find /var/log -type f -delete
echo "Successfully Removed logs"
sleep 2
fi
fi fi
header_info header_info
echo -e "${BL}[Info]${GN} Cleaning $name${CL} \n" echo -e "${BL}[Info]${GN} Cleaning $name${CL} \n"