Skip to content

Instantly share code, notes, and snippets.

Created October 31, 2011 20:49
Show Gist options
  • Save anonymous/1328871 to your computer and use it in GitHub Desktop.
Save anonymous/1328871 to your computer and use it in GitHub Desktop.
#!/bin/bash
# CONFIG
# DEBUG: Set this to 1 if you want debug info
debug=1
lines=0
for file in $(find . -type f)
do
ftype=$(file -ib ${file})
if [ "${ftype%%/*}" == "text" ]
then
if [ $debug != 0 ]
then
echo "Counting lines from ${ftype} file ${file}"
fi
flines=$(cat ${file} | wc -l)
lines=$[$lines+$flines]
else
if [ $debug != 0 ]
then
echo "Ignoring ${ftype} file ${file}"
fi
fi
done
echo "Lines of Code: ${lines}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment