[PATCH] tests: fix portability issue for echo -n

TK Soh teekaysoh at yahoo.com
Wed Mar 15 04:02:55 UTC 2006


This fix is derived from a recipe in "Unix Power Tools". Tested on Linux (Redhat 9), Solaris 2.6,
Solaris 9 and HP-UX 11i.

# HG changeset patch
# User TK Soh <teekaysoh at yahoo.com>
# Node ID 37aebf4f5f51094e2fdd3bbad0e586476adcc175
# Parent  f0b139e74b4740b338619dc0765a961ed220d07e
tests: fix portability issue for echo -n

diff -r f0b139e74b47 -r 37aebf4f5f51 tests/run-tests
--- a/tests/run-tests	Wed Mar 15 08:42:04 2006 +0800
+++ b/tests/run-tests	Wed Mar 15 11:52:51 2006 +0800
@@ -19,8 +19,14 @@ HGMERGE=true; export HGMERGE
 HGMERGE=true; export HGMERGE
 HGUSER="test"; export HGUSER
 
-ECHO_N="echo -n"
-[ -x /usr/ucb/echo ] && ECHO_N="/usr/ucb/echo -n"
+if [ `echo -n HG` == "-n HG" ]
+then
+    ECHO_N=echo
+    NNL="\c"
+else
+    ECHO_N="echo -n"
+    NNL=
+fi
 
 umask 022
 
@@ -138,7 +144,7 @@ fi
 fi
 
 for f in $TESTS ; do
-    $ECHO_N "."
+    $ECHO_N ".${NNL}"
     run_one $f || failed=`expr $failed + 1`
     tests=`expr $tests + 1`
 done


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Mercurial mailing list