aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/scripts/xzless.in3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/scripts/xzless.in b/src/scripts/xzless.in
index a3da697c..9bc9706b 100644
--- a/src/scripts/xzless.in
+++ b/src/scripts/xzless.in
@@ -46,7 +46,8 @@ if test "${LESSMETACHARS+set}" != set; then
LESSMETACHARS="$space$tab$nl'"';*?"()<>[|&^`#\$%=~'
fi
-if test "$(less -V | { read ver && echo ${ver#less }; })" -ge 429; then
+less_ver=$(less -V | awk '/^less ([0-9]+)( \(.*\))?$/ { print $2; exit }')
+if test -n "$less_ver" && test "$less_ver" -ge 429; then
# less 429 or later: LESSOPEN pipe will be used on
# standard input if $LESSOPEN begins with |-.
LESSOPEN="|-$xz -cdfq -- %s"