#!/bin/bash # Colores BLUE="\033[34m" RED="\033[31m" NOCOLOR="\033[0m" # Control de salida con Ctrl + C function ctrl_c() { echo -e "${RED}\n\n[!] Saliendo... \n${NOCOLOR}" tput cnorm exit 1 } # Ctrl+C trap ctrl_c SIGINT # Main for fichero in $(ls); do if [[ -f "$fichero" ]]; then cuenta=$(cat "$fichero" | wc -l) echo -e "El fichero ${BLUE}$fichero ${NOCOLOR}tiene ${RED}$cuenta ${NOCOLOR}lineas" fi done