Advertisement
anjishnu

deljunk

Sep 15th, 2011
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.40 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. ScriptName=$(basename $0)
  4. DelBackup="false"
  5. Notify="false"
  6. HelpText="Deletes the extra file created by latex and it's variants in the
  7. current working directory.
  8. Usage: $ScriptName [options]
  9.  
  10. Options:
  11. -h|--help       Show this help and exit
  12. -b              Delete backup (*.*~ and .*.swp) files. Default.
  13. -b-             Don't delete backup (*.*~ and .*.swp) files
  14. -n              Notify after delete completion.
  15. -n-             Don't notify after delete completion.
  16. "
  17. ErrMsg="$ScriptName: Unspecified option. Aborting."
  18.  
  19. while test -n "$1"
  20. do
  21.     case "$1" in
  22.         -h|--help)  echo -n "$HelpText"
  23.                     exit 0
  24.                     ;;
  25.  
  26.         -b)         DelBackup="true" ;;
  27.  
  28.         -b-)        DelBackup="false" ;;
  29.  
  30.         -n)         Notify="true" ;;
  31.  
  32.         -n-)         Notify="false" ;;
  33.  
  34.         *)          echo "$ErrMsg"
  35.                     exit 1 ;;
  36.     esac
  37.     shift
  38. done
  39.  
  40. rm -fv  *.aux *.log *.dvi *.blg *.bbl *.bbx *.end *.out *.toc *.los *.bak \
  41.         *.hp *.relyx* *.over *.nav *.snm *.vrb *.tmp *.idx *.ilg *.ind \
  42.         *.lof *.lot core *.gls *.nlo *.nls *.inputs *.bm *.fdb_latexmk \
  43.         *.synctex.gz *.pdfsync
  44.  
  45. if [ "$DelBackup" == "true" ];then
  46.     rm -fv .*.swp *.*~ *.*.backup
  47. fi
  48.  
  49. ## Requires libnotify-bin to be installed
  50. if [ "$Notify" == "true" ];then
  51.     notify-send -t 3000 "Deljunk" "Deleting junk files complete" &
  52. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement