Skip to content

Instantly share code, notes, and snippets.

@tueda
Created October 21, 2013 09:13
Show Gist options
  • Save tueda/7080899 to your computer and use it in GitHub Desktop.
Save tueda/7080899 to your computer and use it in GitHub Desktop.
filesize <filename> prints the size of the given file.
filesize() {
if [ -f "$1" ]; then
wc -c "$1" | awk '{print $1}'
else
echo "filesize: file $1 doesn't exist" >&2
return 1
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment