How do I identify if there is any content in a file?
If there is nothing in a specified file, I'd like to send an email indicating that there is nothing to report.
Any help appreciated.
How do I identify if there is any content in a file?
If there is nothing in a specified file, I'd like to send an email indicating that there is nothing to report.
Any help appreciated.
if [ -s myfile ] ; then
echo 'there is Something in this file'
echo 'there is some Size to this file'
else
echo 'file is empty'
fi
You can use the "-f" option too, to make sure that a file exists in the first place.
The "-s" option checks for a non-zero size file.
See if your unix has a man page for "test".
Thanks guys.
I ended uo doing a set `file $myfile` and grabbing $2.
Learning something new everyday