From a94d04b136e95710e8670465a6e41243df70867f Mon Sep 17 00:00:00 2001 From: Thomas Levine <_@thomaslevine.com> Date: Mon, 29 Feb 2016 00:41:03 +0000 Subject: [PATCH] sort -m --- urchin | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/urchin b/urchin index 78bfc51..2594064 100755 --- a/urchin +++ b/urchin @@ -228,7 +228,12 @@ report_outcome() { # Use a temporary file rather than a pipe because a pipe starts a sub-shell # and thus makes the above variables local. sorted_log_file=$(mktemp) - sort "$log_file" > $sorted_log_file + + # Sort in alphabetical order. + # GNU sort requires -m, and BSD sort doesn't. + sort -m "$log_file" > $sorted_log_file || + sort "$log_file" > $sorted_log_file + while read line; do abspath=$(echo "$line" | cut -f1) path=$(echo "$abspath" | sed "s/$escaped_root\/\?//")