]> diplodocus.org Git - nmh/commitdiff
Detect whether or not to use -n with tail in build_nmh.
authorDavid Levine <levinedl@acm.org>
Thu, 9 Jan 2014 00:23:10 +0000 (18:23 -0600)
committerDavid Levine <levinedl@acm.org>
Thu, 9 Jan 2014 00:23:10 +0000 (18:23 -0600)
Synched that to uip/mhmail.

docs/contrib/build_nmh
uip/mhmail

index cb2265c..b00ad90 100755 (executable)
@@ -119,6 +119,11 @@ finddir() {
   esac
 }
 
+#### Figure out whether or not to use -n with tail.
+case `printf 'OK\n' | tail -n 1 2>&1` in
+  OK) tail='tail -n ' ;;
+  *)  tail='tail -' ;;
+esac
 
 if install-mh -check >/dev/null 2>&1; then
   # Determine config options from installed nmh.
@@ -290,7 +295,7 @@ if [ $status -eq 0 ]; then
       echo "$tests_summary" >>"$logfile"
       echo '===================' >>"$logfile"
       [ "$check" = distcheck ]  &&  \
-        echo "$checkoutput" | tail -n 4 >>"$logfile"
+        echo "$checkoutput" | ${tail}4 >>"$logfile"
     fi
 
     if [ $status -eq 0 ]; then
index a00d7cc..916732d 100755 (executable)
@@ -50,11 +50,10 @@ finddir() {
 
 bindir=`finddir $0`
 nmhbindir=`cd "$bindir" && pwd`
-if printf 'OK\n' | tail -n 1 2>&1 | grep OK >/dev/null; then
-    tail='tail -n'
-else
-    tail='tail -'
-fi
+case `printf 'OK\n' | tail -n 1 2>&1` in
+  OK) tail='tail -n ' ;;
+  *)  tail='tail -' ;;
+esac
 
 
 #### Checks for missing mandatory arguments.