Skip to content
Browse files

Merge pull request #17 from svnieuw/master

Fix stat incompatibility with BSD variants.
  • Loading branch information...
2 parents 2ce10ca + 527e65a commit a5bddd08ec1c0cf2937ef219ab4d18b1bcb81dfb @rtomayko committed Dec 10, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 shocco.sh
View
8 shocco.sh
@@ -384,7 +384,13 @@ HTML
# Ultimately, this means that if `code0000` is empty, the `-r` option
# should not be provided with the final `-k` option group to `sort`(1) in
# the pipeline below.
-[ "$(stat -c"%s" "code0000")" = 0 ] && sortopt="" || sortopt="r"
+if stat -c"%s" /dev/null >/dev/null 2>/dev/null ; then
+ # GNU stat
+ [ "$(stat -c"%s" "code0000")" = 0 ] && sortopt="" || sortopt="r"
+else
+ # BSD stat
+ [ "$(stat -f"%z" "code0000")" = 0 ] && sortopt="" || sortopt="r"
+fi
# Start the pipeline with a simple list of split out temp filename. One file
# per line.

0 comments on commit a5bddd0

Please sign in to comment.
Something went wrong with that request. Please try again.