From: Avery Pennarun Date: Thu, 7 Jan 2010 23:16:52 +0000 (-0500) Subject: On MacOS X, "wc -l" returns extra whitespace. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=3198fba54521cd7f313a02d237f9198dd58f6a90;p=packages%2Fb%2Fbup.git On MacOS X, "wc -l" returns extra whitespace. ie. " 0" instead of "0". The easiest workaround is to compare as a number instead of as a string. This seems to work correctly on both MacOS and Linux. --- diff --git a/test-sh b/test-sh index d2583a7..f48be99 100755 --- a/test-sh +++ b/test-sh @@ -45,7 +45,7 @@ diff -u testfile2 out2c.tmp egrep -v 'dangling (commit|tree)' | tee -a /dev/stderr | wc -l) - if [ "$n" != 0 ]; then + if [ "$n" -ne 0 ]; then echo "git fsck error." exit 5 fi