Question:
How to check the file is exist or not and if it exists then the size is zero or not
file="/home/kalam/if_condition.sh"
if [ -e $file ]
then
echo “File exists”
else
echo “File does not exist”
fi
## Checking for file size is Zero or not
if [ -s $file ]
then
echo “File size is zero”
else
echo “File size is not zero”
fi
No comments:
Post a Comment