Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # ======================== #
- # ======== Colors ======== #
- # ======================== #
- BLD="\e[1m"
- GRN="\e[32m"
- RED="\e[31m"
- RES="\e[39m"
- ORG="\e[33m"
- NOR="\e[0m"
- # ======================== #
- # ====== Main script ===== #
- # ======================== #
- echo -e "${BLD}[${GRN}OK${RES}${BLD}]${NOR} Clean temporary files...${RES}${NOR}";
- COMMAND=$(find . -type f \( -name "*~" -o -name "#*#" \) -print)
- for FILE in $COMMAND; do
- RET=$(rm -f ${FILE})
- if [[ $RET != "" ]]; then
- echo -e "${BLD}[${RED}NO${RES}${BLD}]${NOR} Error in deletion of file '${FILE}'.${RES}${NOR}";
- echo -e "${BLD}[${RED}NO${RES}${BLD}]${NOR} Error: ${RET}${RES}${NOR}";
- else
- echo -e "${BLD}[${GRN}OK${RES}${BLD}]${NOR} File '${FILE}' successfully deleteted.${RES}${NOR}";
- fi
- done
- echo -e "${BLD}[${GRN}OK${RES}${BLD}]${NOR} Temporary files has successfully cleaned.${RES}${NOR}";
Add Comment
Please, Sign In to add comment