Guest User

Untitled

a guest
Jan 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # ======================== #
  4. # ======== Colors ======== #
  5. # ======================== #
  6.  
  7. BLD="\e[1m"
  8. GRN="\e[32m"
  9. RED="\e[31m"
  10. RES="\e[39m"
  11. ORG="\e[33m"
  12. NOR="\e[0m"
  13.  
  14. # ======================== #
  15. # ====== Main script ===== #
  16. # ======================== #
  17.  
  18. echo -e "${BLD}[${GRN}OK${RES}${BLD}]${NOR} Clean temporary files...${RES}${NOR}";
  19.  
  20. COMMAND=$(find . -type f \( -name "*~" -o -name "#*#" \) -print)
  21.  
  22. for FILE in $COMMAND; do
  23. RET=$(rm -f ${FILE})
  24.  
  25. if [[ $RET != "" ]]; then
  26. echo -e "${BLD}[${RED}NO${RES}${BLD}]${NOR} Error in deletion of file '${FILE}'.${RES}${NOR}";
  27. echo -e "${BLD}[${RED}NO${RES}${BLD}]${NOR} Error: ${RET}${RES}${NOR}";
  28. else
  29. echo -e "${BLD}[${GRN}OK${RES}${BLD}]${NOR} File '${FILE}' successfully deleteted.${RES}${NOR}";
  30. fi
  31. done
  32.  
  33. echo -e "${BLD}[${GRN}OK${RES}${BLD}]${NOR} Temporary files has successfully cleaned.${RES}${NOR}";
Add Comment
Please, Sign In to add comment