Skip to content

Instantly share code, notes, and snippets.

@informationsea
Created January 17, 2012 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save informationsea/1626548 to your computer and use it in GitHub Desktop.
Save informationsea/1626548 to your computer and use it in GitHub Desktop.
Count lines of files in the directory.
function countlines() {
local basedir=$1
local currentlines='0'
local thislines
shift 1
while [ $1 ] ;do
thislines=`find "$basedir" -type f -name "*.$1" -print0 | xargs -0 cat | wc -l`
currentlines=$(($thislines + $currentlines))
shift 1
done
echo $currentlines
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment