title: Why doesn't my mercurial pre-commit hook work in MinGW
body: <p>I have a pre-commit hook in my .hgrc file which checks if more than 5MB of files will be added to the repository. The hook is:</p>
  
  <pre><code>pre-commit.added-files-too-large = test 5000 -gt `hg status --added --no-status --print0 | xargs --null ls -lk | awk \'{sum += $5} END {print sum}\'`
  </code></pre>
  
  <p>This works fine on Linux (using bash) but doesn't work on MinGW. If I simply run the same command from the MinGW shell command line it works as expected.</p>
  
  <p>The error message is </p>
  
  <pre><code>test: invalid integer ``hg'
  </code></pre>
  
  <p>I suspect that the error is something to do with how things are quoted but I've tried lots of combinations (including changing the backticks to $()) and I can't seem to find the correct answer.</p>
  
  <p>Any help or pointers would be greatly appreciated.</p>