求指导

第一次写这些写的乱七八糟的,如果有愿意指导的,指点一下,万分感谢!!!

#!/bin/bash
#清理清理缓存-------------------------------------------------------------#
echo "清理缓存"
echo "y or n"
read choose
if [ $choose = "y" ]
then
#firefox-trunk-----thumbnails--------software-center---------------------#
   cd ~/.cache/thumbnails/ && du -sh && rm -rf * && cd
   cd ~/.cache/software-center/ && du -sh && rm -rf * && cd
   cd ~/.cache/mozilla/firefox-trunk/62bz1yha.default/ && du -sh && rm -rf * && cd
#clean the useless package#---dns----------------------------------------#
   sudo apt-get clean
   sudo apt-get autoclean
   sudo apt-get autoremove --purge
   sudo /etc/init.d/dns-clean start
#清理以卸载软件残留-------------------------------------------------------#
   dpkg -l | grep ^rc | awk '{print $2}' |sudo xargs dpkg -P 2> /dev/null
#清理系统备份~文件--------------------------------------------------------#
   sudo find / -type f -name '*~' > temp.txt
   for i in `cat temp.txt`
   do
   echo -n "deleting the file:"
   echo ${i}
   sudo rm ${i}
   done
   sudo rm temp.txt
#update---------------------------------------------------------upgrade--#
   sudo apt-get update || sudo apt-get upgrade
   
echo "清理完成并已更新"
fi
exit 0

xx.sh.zip (636 Bytes)