From: Benjamin Auder Date: Fri, 21 Dec 2018 22:24:29 +0000 (+0100) Subject: Add a simple code lines counter X-Git-Url: https://git.auder.net/doc/html/scripts/css/img/current/mini-custom.min.css?a=commitdiff_plain;h=73564bf6340694c2e8a67a7c57334da5c1c23a73;p=vchess.git Add a simple code lines counter --- diff --git a/countLines.sh b/countLines.sh new file mode 100755 index 00000000..3de43049 --- /dev/null +++ b/countLines.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# Count code lines ( using answer https://stackoverflow.com/a/965072 ) + +function countFoldExt() +{ + count=0 + for fullfile in `find $1`; do + filename=$(basename -- "$fullfile") + extension="${filename##*.}" + if [ "$extension" == "$2" ]; then + count=$((count+`wc -l $fullfile | grep -o ^[0-9]*`)) + fi + done + echo $count +} + +count=0 +count=$((count + $(countFoldExt "app.js" "js"))) +count=$((count + $(countFoldExt "gulpfile.js" "js"))) +count=$((count + $(countFoldExt "sockets.js" "js"))) +count=$((count + $(countFoldExt "bin" "www"))) +count=$((count + $(countFoldExt "db" "sql"))) +count=$((count + $(countFoldExt "public" "js"))) +count=$((count + $(countFoldExt "public" "sass"))) +count=$((count + $(countFoldExt "routes" "js"))) +count=$((count + $(countFoldExt "views" "pug"))) +echo $count