I have a file called diff.txt. I Want to check whether it is empty.
I wrote a bash script something like below, but I couldn\'t get it work.
@geedoubleya answer is my favorite.
However, I do prefer this
if [[ -f diff.txt && -s diff.txt ]] then rm -f empty.txt touch full.txt elif [[ -f diff.txt && ! -s diff.txt ]] then rm -f full.txt touch empty.txt else echo "File diff.txt does not exist" fi