Guest User

Shell Script - Auto-Rm

a guest
Oct 25th, 2010
1,968
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # Shell Script - Auto-RM
  4. # ===========================================
  5. # Autor:- CESAR AUGUSTUS SILVA
  6. #
  7.  
  8. # Diretório Raiz
  9. raiz="$1"
  10.  
  11. novo() {
  12. for lista in *
  13. do
  14. if [ "$lista" != '*' ]
  15. then
  16. if [ -d "$lista" ]
  17. then
  18. cd "$lista"
  19. novo
  20. rm -f abc123@* 2> /dev/null
  21. cd ..
  22. fi
  23. fi
  24. done
  25. }
  26.  
  27. if [ "`whoami`" != "root" ]
  28. then
  29. echo "Você não possui privilégios de superusuário"
  30. else
  31. if [ "$raiz" == "" ]
  32. then
  33. echo "Diretório Raiz vazio."
  34. else
  35. if [ -e "$raiz" ]
  36. then
  37. cd "$raiz"
  38. echo "Aguarde..."
  39. rm -f abc123@* 2> /dev/null
  40. novo
  41. echo "Pronto."
  42. else
  43. echo "Diretório Raiz não existe."
  44. fi
  45. fi
  46. fi
Advertisement
Add Comment
Please, Sign In to add comment