Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- function ficheros {
- numficheros=`file *| grep -i "$1" | wc -l`
- contador=1
- echo -e " -Hay $numficheros ficheros de "$2":`file * | grep -i "$1" | cut -d ":" -f 1 |
- while read line
- do
- if [ "$numficheros" -ne "$contador" ]
- then
- echo -n "$line, "
- else
- echo "$line"
- fi
- let contador=contador+1
- done`"
- }
- if [ "$#" -eq "1" ]
- then
- if test -d "$1" 2> /dev/null && test -d "$1" 2> /dev/null
- then
- directorio=$1
- else
- echo "./shell1 [directorio_permisos_lectura]"
- exit 1
- fi
- elif [ "$#" -eq "0" ]
- then
- directorio=$PWD
- else
- echo "./shell1 [directorio_permisos_lectura]"
- exit 1
- fi
- cd $directorio
- echo "La clasificación de ficheros del directorio $directorio es:"
- tipo="text"
- tcompleto="texto"
- ficheros $tipo $tcompleto
- tipo="device"
- tcompleto="dispositivo"
- ficheros $tipo $tcompleto
- tipo="directory"
- tcompleto="directorio"
- ficheros $tipo $tcompleto
- tipo="executable"
- tcompleto="tipo ejecutable"
- ficheros $tipo $tcompleto
Advertisement
Add Comment
Please, Sign In to add comment