kk Blog —— 通用基础


date [-d @int|str] [+%s|"+%F %T"]
netstat -ltunp
sar -n DEV 1

统计git提交行数的脚本

可以保存为count.sh运行 ./count.sh your_name

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh
insert=0
delete=0
git log --author=$1 --since "2022-01-01" --shortstat --pretty=format:"" application/ | sed /^$/d > /tmp/tmp.count

while read line ;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}'`
if [ "$current" != "" ]; then
	delete=`expr $delete + $current`
fi
done < /tmp/tmp.count

echo $1 $insert insertions, $delete deletions