This bash script enables you to calculate the total number of lines of source code.
Example usage: 1. calculate total number of lines of java source files. $ line.sh java
- calculate total number of lines of python source files. $ line.sh py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #!/bin/bash
# @date: May 23, 2011
# @author: Shao-Chuan Wang
# Example usage:
# calculate total number of lines of java source files.
# $ line.sh java
# calculate total number of lines of python source files.
# $ line.sh py
line=0
for f in `find . -type f -name "*.$1"`
do
li=`wc -l $f | awk '{print $1}'`
let "line = $line + $li"
done
echo "Total lines: $line"
|
Tags: line
I'd like to write it as following:
Hey, Max. Thank for the feedbacks. =)