Advertisement
Guest User

musindetfinal

a guest
Nov 22nd, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.29 KB | None | 0 0
  1. #!/bin/bash
  2. # SI2A Otero Cruz, Christopher
  3. # creamos la función de menú
  4. menu() {
  5. clear
  6. echo "bienvenido a identifica.sh  pulsa control+c para salir"
  7. echo "dime el nombre del archivo que quieres crear "
  8. read nom
  9. echo "dime que extensión tendrá el archivo "
  10. read ext
  11. sleep 1
  12. echo "ahora crearé el documento $nom con la extensión $ext "
  13. echo "este documento contrendrá tu identificación"
  14. echo "pulsa intro para continuar"
  15. read foo
  16. touch $nom.$ext
  17. echo "#SI2A otecruchr Otero Cruz, Christopher `date '+%d-%B-%Y  %T'`" >> $nom.$ext
  18. }
  19. ayuda() {
  20. echo "
  21. "
  22. echo "si quieres identificar un documento escribe su nombre y extensión, por ejemplo 'sh identifica.sh holamundo.txt'.
  23.  
  24. nenú de creación      -m
  25. identificar no identificados    -a
  26. ayuda               -h, --help"
  27. echo "
  28.  
  29. "
  30. }
  31. lista(){
  32. N=0
  33. for ARCH in `grep -lL "Otero Cruz, Christopher" *.*`
  34. do
  35. echo "#SI2A otecruchr Otero Cruz, Christopher `date '+%d-%B-%Y  %T'`" >> $ARCH.bak
  36. cat $ARCH >> $ARCH.bak
  37. rm $ARCH
  38. mv $ARCH.bak $ARCH
  39. N=`expr $N + 1`
  40. done
  41. echo "se encontraron $N archivos en los que se añadieron tu identificación"
  42. }
  43.  
  44. case $1 in
  45. -m)
  46. menu
  47. ;;
  48. -h)
  49. ayuda
  50. ;;
  51. --help)
  52. ayuda
  53. ;;
  54. -a)
  55. lista
  56. ;;
  57. *)
  58. echo "#SI2A otecruchr Otero Cruz, Christopher `date '+%d-%B-%Y  %T'`" >> $1.bak
  59. cat $1 >> $1.bak
  60. rm $1
  61. mv $1.bak $1
  62. ;;
  63. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement