我想通过散布的评论使每个操作都保持在自己的位置上
如果没有 kludgy 临时文件,是否有办法做到这一点
#!/bin/sh
git diff --stat `git hash-object -t tree /dev/null` > tmp.txt
# not my code
grep -v "^ kazmath" tmp.txt > tmp2.txt
grep -v "\.obj " tmp2.txt > tmp.txt
grep -v "\.png " tmp.txt > tmp2.txt
grep -v "\.gbo " tmp2.txt > tmp.txt
# not my code
grep -v "obj2opengl\.pl " tmp.txt > tmp2.txt
grep -v "\.txt " tmp2.txt > tmp.txt
grep -v "\.md " tmp.txt > tmp2.txt
grep -v "\.blend " tmp2.txt > tmp.txt
# +'s at end of line
sed 's/+*$//' tmp.txt > tmp2.txt
# ditch last line
sed '$d' < tmp2.txt > tmp.txt
echo -n "lines of code "
cut -d '|' -f 2 tmp.txt | awk '{ sum+=$1} END {print sum}'
rm tmp.txt
rm tmp2.txt