Skip to content

Instantly share code, notes, and snippets.

@JesseEisen
Created September 23, 2014 12:25
Show Gist options
  • Save JesseEisen/d57ae1681ba0c06018b2 to your computer and use it in GitHub Desktop.
Save JesseEisen/d57ae1681ba0c06018b2 to your computer and use it in GitHub Desktop.
my personal tool to count source file lines. This is Shell version
#!/bin/bash
# write to count the sourcefile
w=0
par=$3
origin=2
echo "${par:=$origin}"
for s in $(find $1 -maxdepth ${par:=$origin} -type f -name "*.$2")
do
t=$(wc -l $s | awk '{print $1}')
echo -e "$s: \e[1;32m $t \e[0m"
let "w=w+t"
done
echo -e "\e[1;31m total:\e[1;32m $w \e[0m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment