Skip to content

Instantly share code, notes, and snippets.

@CallMarl
Last active April 3, 2020 08:54
Show Gist options
  • Save CallMarl/99a7b9a6a7ec849121f20c1d84bb7838 to your computer and use it in GitHub Desktop.
Save CallMarl/99a7b9a6a7ec849121f20c1d84bb7838 to your computer and use it in GitHub Desktop.
Linux utils script

file location:

  • /usr/local/src/vim_cleaner.sh
vim_cleaner.sh
chown root vim_cleaner.sh && chgrp root vim_cleaner.sh
chmod 775 /usr/local/src/vim_cleaner.sh # 771
ln -sf /usr/local/src/vim_cleaner.sh /usr/local/bin/cleaner
#!/bin/bash
EXT=""
EXT=$EXT"\.o\~|"
EXT=$EXT"\.c\~|"
EXT=$EXT"\.h\~|"
EXT=$EXT"\.a\~|"
EXT=$EXT"\.sh\~|"
EXT=$EXT"\.txt\~|"
EXT=$EXT"\.md\~"
REG_EXT=""
REG_EXT=$REG_EXT"[._]*.s[a-v][a-z]|"
REG_EXT=$REG_EXT"[._]*.sw[a-p]|"
REG_EXT=$REG_EXT"[._]s[a-v][a-z]|"
REG_EXT=$REG_EXT"[._]sw[a-p]"
FILE=""
FILE=$FILE"makefile\~|"
FILE=$FILE"Makefile\~|"
FILE=$FILE"\.gitignore\~|"
FILE=$FILE"\.bashrc\~|"
FILE=$FILE"\.zshrc\~|"
FILE=$FILE"\.zshalias\~|"
FILE=$FILE"todo~"
find . -regextype posix-extended -regex "(.*($EXT|$REG_EXT|$FILE))" -delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment