Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # SI2A Otero Cruz, Christopher
- # creamos la función de menú
- menu() {
- clear
- echo "bienvenido a identifica.sh pulsa control+c para salir"
- echo "dime el nombre del archivo que quieres crear "
- read nom
- echo "dime que extensión tendrá el archivo "
- read ext
- sleep 1
- echo "ahora crearé el documento $nom con la extensión $ext "
- echo "este documento contrendrá tu identificación"
- echo "pulsa intro para continuar"
- read foo
- touch $nom.$ext
- echo "#SI2A otecruchr Otero Cruz, Christopher `date '+%d-%B-%Y %T'`" >> $nom.$ext
- }
- ayuda() {
- echo "
- "
- echo "si quieres identificar un documento escribe su nombre y extensión, por ejemplo 'sh identifica.sh holamundo.txt'.
- nenú de creación -m
- identificar no identificados -a
- ayuda -h, --help"
- echo "
- "
- }
- lista(){
- N=0
- for ARCH in `grep -lL "Otero Cruz, Christopher" *.*`
- do
- echo "#SI2A otecruchr Otero Cruz, Christopher `date '+%d-%B-%Y %T'`" >> $ARCH.bak
- cat $ARCH >> $ARCH.bak
- rm $ARCH
- mv $ARCH.bak $ARCH
- N=`expr $N + 1`
- done
- echo "se encontraron $N archivos en los que se añadieron tu identificación"
- }
- case $1 in
- -m)
- menu
- ;;
- -h)
- ayuda
- ;;
- --help)
- ayuda
- ;;
- -a)
- lista
- ;;
- *)
- echo "#SI2A otecruchr Otero Cruz, Christopher `date '+%d-%B-%Y %T'`" >> $1.bak
- cat $1 >> $1.bak
- rm $1
- mv $1.bak $1
- ;;
- esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement