Script tipofichero.sh
#!/bin/bash if [ $# -lt 1 ];then echo "Uso: $0 fichero" exit fi FICHERO="$0: " #clasificar el fichero if [ -f $1 ];then FICHERO="$FICHERO fichero" else if [ -d $1 ];then FICHERO="$FICHERO directorio" else if [ -h $1 ];then FICHERO="$FICHERO enlace" else FICHERO="$FICHERO otro tipo" fi fi fi #Comprobar atributos if [ -r $1 ];then FICHERO="$FICHERO lectura" fi if [ -w $1 ];then FICHERO="$FICHERO escritura" fi if [ -x $1 ];then FICHERO="$FICHERO ejecución" fi echo $FICHERO