Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. set -e
  3.  
  4. app_name=$1
  5. dry_run=${2:-false}
  6.  
  7. declare -a locations=(
  8. /Applications
  9. ~/Library/Application\ Support
  10. ~/Library/Preferences
  11. ~/Library/Caches
  12. /Library/Application\ Support
  13. /Library/Preferences
  14. /Library/Caches
  15. )
  16.  
  17. find "${locations[@]}" -maxdepth 1 -iname "*${app_name}*" -prune | \
  18. while read file_to_rm ; do
  19. echo "Confirm rm \"${file_to_rm}\": y/n/c"
  20. while true ; do
  21. read -u 2 confirm_resp
  22. if [ "$confirm_resp" = 'y' ] && [ "$dry_run" != 'true' ] ; then
  23. rm -rf "$file_to_rm"
  24. fi
  25. if [ "$confirm_resp" = 'y' ] || [ "$confirm_resp" = 'n' ] ; then
  26. break
  27. elif [ "$confirm_resp" = 'c' ] ; then
  28. exit 1
  29. fi
  30. done
  31. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement