From 42cc2dd489d46ae5bad7b2645dc4217334c8cb32 Mon Sep 17 00:00:00 2001
From: Nathan Weeks <weeks@iastate.edu>
Date: Wed, 10 Oct 2012 13:13:23 -0500
Subject: [PATCH] If "tac" doesn't exist (e.g., on non GNU/Linux systems like
 OS X & other BSDs), emulate with sed '1!G;h;$!d' (from
 http://www.catonmat.net/blog/sed-one-liners-explained-part-one/)

Since the Makefile executes tests using "sh" instead of "bash", use the more portable "> obs 2>&1" instead of "&> obs" so the test will pass when /bin/sh isn't bash (e.g., on Debian-based Linux distributions, and most non-Linux *nix systems).
---
 test/merge/test-merge.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/merge/test-merge.sh b/test/merge/test-merge.sh
index 04087f69..91cf87df 100644
--- a/test/merge/test-merge.sh
+++ b/test/merge/test-merge.sh
@@ -36,6 +36,7 @@ rm obs exp
 #  Enforce coordinate sorted input.
 ###########################################################
 echo "    merge.t2...\c"
+command -v tac 2>/dev/null || alias tac="sed '1!G;h;\$!d'"
 tac a.bed | $BT merge -i - 2> obs
 echo "ERROR: input file: (-) is not sorted by chrom then start.
        The start coordinate at line 3 is less than the start at line 2" > exp
@@ -67,7 +68,7 @@ echo \
 *****
 *****ERROR: No names found to report for the -names option. Exiting.
 *****" > exp
-$BT merge -i a.bed -nms &> obs
+$BT merge -i a.bed -nms > obs 2>&1
 check obs exp
 rm obs exp
 
-- 
GitLab