You've already forked scripts-random
Add first scripts
This commit is contained in:
25
01_bash/lineas_fichero.sh
Executable file
25
01_bash/lineas_fichero.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#! /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
|
||||
|
||||
Reference in New Issue
Block a user