I want to do conditional logic on whether a file has 0 bytes or more than 0 bytes.
what is the easiest way to do this?
I want to do conditional logic on whether a file has 0 bytes or more than 0 bytes.
what is the easiest way to do this?
if [ -s $file ]
then
echo "$file has a size"
else
echo "$file is empty"
fi
hi,
[ -s "$file_name" ] && echo "non zero length" || echo "zero lenght"