From b84d3f849be5d858d8348a741f6b8ccd881509fe Mon Sep 17 00:00:00 2001 From: David Levine Date: Wed, 8 Jan 2014 18:23:10 -0600 Subject: [PATCH] Detect whether or not to use -n with tail in build_nmh. Synched that to uip/mhmail. --- docs/contrib/build_nmh | 7 ++++++- uip/mhmail | 9 ++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/contrib/build_nmh b/docs/contrib/build_nmh index cb2265cb..b00ad90f 100755 --- a/docs/contrib/build_nmh +++ b/docs/contrib/build_nmh @@ -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 diff --git a/uip/mhmail b/uip/mhmail index a00d7cc9..916732d8 100755 --- a/uip/mhmail +++ b/uip/mhmail @@ -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. -- 2.56.0