Saber si un fichero está vacío en Shell Script
En un script de Bash, para comprobar si un fichero contiene algo o está vacío tenemos el comparador -s, que devuelve verdadero si el fichero contiene algo y falso si está vacío:
#!/bin/bash filename="mi_fichero.txt" if [ -s "$filename" ] then echo "$filename tiene contenido." else echo "$filename esta vacío." fi