view paste/paste.12049 @ 4488:9c8449758bbd

<ion> printf \'%s\\n\' \'if [ "$#" -gt 0 ]; then printf \'\\\'\'%s\\n\'\\\'\' "$*"; else cat; fi\' >bin/print_args_or_input && chmod 755 bin/print_args_or_input
author HackBot
date Sat, 22 Feb 2014 02:25:50 +0000
parents e925c0adf7ad
children
line wrap: on
line source

#!/bin/sh
count () {
    hg log --template '{desc}\n' |
    egrep '<[^]]*> karma\'$1 |
    fgrep -vix "<$2> karma$1 $2" |
    cut -d' ' -f3 |
    fgrep -cix "$2"
}
plus=$(count + "$1")
minus=$(count - "$1")
echo $(($plus-$minus))