Skip to content

Instantly share code, notes, and snippets.

@picasso250
Last active October 13, 2015 16:17
Show Gist options
  • Save picasso250/4222029 to your computer and use it in GitHub Desktop.
Save picasso250/4222029 to your computer and use it in GitHub Desktop.
count how many lines you write in your project dir
#!/bin/sh
if [ x"$1" = x ]
then
code_dir="."
else
code_dir="$1"
fi
if [ x"$2" = x ]
then
exts="php js"
else
exts="$2"
fi
for ext in $exts
do
echo "$ext files"
printf "count: "
find $code_dir -type f -name "*.$ext" | wc -l
printf "lines: "
find $code_dir -type f -name "*.$ext" | xargs wc -l | tail -n 1
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment