Skip to content

Instantly share code, notes, and snippets.

@sshongru
Created May 6, 2013 21:04
Show Gist options
  • Save sshongru/5528183 to your computer and use it in GitHub Desktop.
Save sshongru/5528183 to your computer and use it in GitHub Desktop.
Given a file it returns the file size from wc -c with the extra strings stripped off.
#!/bin/sh
# Usage: ./getFileSize.sh myFile.exe
# Outputs file size of the given file
FILE=${1}
DIRTY=`wc -c ${FILE}`
CLEAN="${DIRTY}"
CLEAN="${CLEAN% *}"
CLEAN="${CLEAN##* }"
echo ${CLEAN}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment