Created
October 12, 2020 06:31
-
-
Save leftclickben/c0dbc549b9eefdb5eacbc56fd870a09d to your computer and use it in GitHub Desktop.
Source analytics
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 | |
set -u | |
# usage example to find all Java source files: ./sloc-by-extension java | |
EXTENSION="${1}" | |
for dir in $(ls -d */); do | |
pushd ${dir} >/dev/null | |
LIST=$(find . -name "*.${EXTENSION}" | grep -iv test) | |
if [ ! -z "${LIST}" ]; then | |
echo ${dir} | sed 's/\/\///g' | |
echo $(wc -l ${LIST} | tail -n 1) | |
fi | |
popd >/dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment