Created
January 8, 2014 21:01
-
-
Save coderofsalvation/8324593 to your computer and use it in GitHub Desktop.
detect if arg is an empty file, returns 0 on sucess, 1 otherwise (bashfunction)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# detect if arg is an empty file, returns 0 on sucess, 1 otherwise | |
# @param string file | |
function isemptyfile() | |
{ [ -z "$1" ] && return 1 | |
if [ -f "$1" ] && [ X"$(wc -c "$1" | cut -d" " -f1)" = X"0" ]; then | |
return 0 | |
else | |
return 1 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment