可以保存为count.sh运行 ./count.sh your_name
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| #!/bin/sh
insert=0
delete=0
git log--author=$1--shortstat--pretty=format:""|sed/^$/d >.tmp.count
whilereadline ;do
current=`echo$line|awk-F',''{printf $2}'|awk'{printf $1}'`
insert=`expr$insert+ $current`
current=`echo$line|awk-F',''{printf $3}'|awk'{printf $1}'`
delete=`expr$delete+ $current`
done<.tmp.count
rm .tmp.count
echo$1$insertinsertions, $deletedeletions
|