Created
May 20, 2016 14:15
-
-
Save koniu/95cb7666f4fa04f574ddd5927b526a4a to your computer and use it in GitHub Desktop.
Calculate comment density of shell scripts in a directory
This file contains 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
dir=/rom; a=$(find $dir -name \*.sh -exec cat '{}' \; | egrep -cv '^[[:space:]]*#'); b=$(find $dir -name \*.sh -exec cat '{}' \; | egrep -c '^[[:space:]]*#'); echo "$((a+b)) lines = ${a} sloc [$((a*100/(a+b)))%] + ${b} comments [$((b*100/(a+b)))%]" | |
# 7882 lines = 7576 sloc [96%] + 306 comments [3%] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment