-
-
Save LeoAdamek/1328999 to your computer and use it in GitHub Desktop.
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
#!/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