Permalink
Browse files

Fixed bug: awk uses BEGIN not START

  • Loading branch information...
Matt Curtis authored and icefox committed Apr 1, 2011
1 parent f3b5342 commit a5e15448e0181c0f77eb12eed4e9cc15e347e365
Showing with 3 additions and 3 deletions.
  1. +3 −3 git-achievements
View
@@ -83,9 +83,9 @@ function unlock_achievement()
function count_command
{
- export power=`awk "START {n=0} /$1/ {n++} END { print log(n)/log(2) }" "$ACTIONLOGFILE"`
- export count=`awk "START {n=0} /$1/ {n++} END { print n }" "$ACTIONLOGFILE"`
- #export powerof2=`awk "START {n=0} /$1/ {n++} END { print and(n, n-1) }" "$ACTIONLOGFILE"`
+ export power=`awk "BEGIN {n=0} /$1/ {n++} END { print log(n)/log(2) }" "$ACTIONLOGFILE"`
+ export count=`awk "BEGIN {n=0} /$1/ {n++} END { print n }" "$ACTIONLOGFILE"`
+ #export powerof2=`awk "BEGIN {n=0} /$1/ {n++} END { print and(n, n-1) }" "$ACTIONLOGFILE"`
# mysys gawk it old and doesn't have the bitwise operation and :( so we have to use perl for now
export powerof2=`echo 'use Env; $y=$ENV{'count'}; $x=($y & ($y-1)); print "$x\n" ' | perl -`

0 comments on commit a5e1544

Please sign in to comment.