Update clean.sh

tweak
This commit is contained in:
tteckster 2023-01-29 15:20:01 -05:00 committed by GitHub
parent c9e3b72dfa
commit 6b3d7a7bf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
function header_info {
function header_info() {
cat <<"EOF" cat <<"EOF"
________ __ _ ________ ________ __ _ ________
/ ____/ /__ ____ _____ / / | |/ / ____/ / ____/ /__ ____ _____ / / | |/ / ____/
@ -9,49 +10,57 @@ function header_info {
EOF EOF
} }
BL=$(echo "\033[36m") BL=$(echo "\033[36m")
GN=$(echo "\033[1;92m") GN=$(echo "\033[1;92m")
CL=$(echo "\033[m") CL=$(echo "\033[m")
name=$(hostname) name=$(hostname)
clear clear
header_info header_info
echo -e "${BL}[Info]${GN} Cleaning $name${CL} \n" echo -e "${BL}[Info]${GN} Cleaning $name${CL} \n"
# Clean cache
cache=$(find /var/cache/ -type f) cache=$(find /var/cache/ -type f)
if [[ -z "$cache" ]]; then 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
else
echo -e "$cache \n"
echo -e "${GN}Cache in $name${CL}"
read -p "Would you like to remove the selected cache listed above? [y/n] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Removing cache"
find /var/cache -type f -delete
echo "Successfully Removed cache"
sleep 2 sleep 2
else fi
echo -e "$cache \n" fi
echo -e "${GN}Cache in $name${CL}"
read -p "Would you like to remove the selected cache listed above? [y/n] " -n 1 -r # Clean logs
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Removing cache"
find /var/cache -type f -delete
echo "Successfully Removed cache"
sleep 2
fi
fi
clear clear
header_info header_info
echo -e "${BL}[Info]${GN} Cleaning $name${CL} \n" echo -e "${BL}[Info]${GN} Cleaning $name${CL} \n"
logs=$(find /var/log/ -type f) logs=$(find /var/log/ -type f)
if [[ -z "$logs" ]]; then 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
else
echo -e "$logs \n"
echo -e "${GN}Logs in $name${CL}"
read -p "Would you like to remove the selected logs listed above? [y/n]" -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Removing logs"
find /var/log -type f -delete
echo "Successfully Removed logs"
sleep 2 sleep 2
else fi
echo -e "$logs \n" fi
echo -e "${GN}Logs in $name${CL}"
read -p "Would you like to remove the selected logs listed above? [y/n]" -n 1 -r # Populate apt lists
echo clear
if [[ $REPLY =~ ^[Yy]$ ]]; then header_info
echo "Removing logs" echo -e "${BL}[Info]${GN} Cleaning $name${CL} \n"
find /var/log -type f -delete echo -e "${GN}Populating apt lists${CL} \n"
echo "Successfully Removed logs"
sleep 2
fi
fi
clear
header_info
echo -e "${BL}[Info]${GN} Cleaning $name${CL} \n"
echo -e "${GN}Populating apt lists${CL} \n"