Fix usage of tput
authorSteve McIntyre <steve@einval.com>
Mon, 5 Mar 2018 12:54:47 +0000 (12:54 +0000)
committerSteve McIntyre <steve@einval.com>
Mon, 5 Mar 2018 12:54:47 +0000 (12:54 +0000)
It doesn't like having stderr redirected, so use new_checkexec instead

abcde

diff --git a/abcde b/abcde
index 15f8b31..7784b5d 100755 (executable)
--- a/abcde
+++ b/abcde
@@ -225,13 +225,13 @@ page ()
 {
        PAGEFILE="$1"
        local NUM_LINES=$(wc -l < "$PAGEFILE")
+       local LINES=""
 
        # Check the terminal length every time we're called - the user
        # might have resized since last time we were here
-
        # First, try tput
-       if [ -z "$LINES" ]; then
-               LINES=$(tput lines 2>/dev/null)
+       if new_checkexec tput; then
+               LINES=$(tput lines)
        fi
 
        # If tput didn't work, 24 will do...