Thursday, 28 March 2019

shell script to find file availability

if [ -f jan_demo_text.txt ]  #checking file availability
then
    if [ -s jan_demo_text.txt ]
    then  #data available means do it
        echo "data available"
    else  #file empty means do it.
        echo "File exists but empty"
exit
   fi
else
    echo "File not exists"

fi


No comments:

Post a Comment