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