How to check if a file is empty in bash shell?
I have one file, **diff.txt**

Wanted to write a simple if/else script in bash to check if diff.txt is empty. Did something like this but couldn't get it working.


    if [ -s diff.txt ]
    then
            touch empty.txt
            rm full.txt
    else
            touch full.txt
            rm emtpy.txt
    fi


Suspect it's the naming of the filename but googled and got nowhere.
How to check if a file is empty in bash shell?
===

I have one file, **diff.txt**

Wanted to write a simple if/else script in bash to check if diff.txt is empty. Did something like this but couldn't get it working.


    if [ -s diff.txt ]
    then
            touch empty.txt
            rm full.txt
    else
            touch full.txt
            rm emtpy.txt
    fi


Suspect it's the naming of the filename but googled and got nowhere.