[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] zless: support compressed stdin

From: Paul Eggert
Subject: Re: [PATCH] zless: support compressed stdin
Date: Wed, 21 Dec 2011 16:13:28 -0800
User-agent: Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111124 Thunderbird/8.0

Thanks, I fixed that in a slightly different way,
something more portable to ancient shells.

zless: decompress stdin too, if less 429 or later
* zless.in: Use LESSOPEN |- feature of less 429 or later.
Problem reported by Jeroen Roovers via Mike Frysinger in
diff --git a/zless.in b/zless.in
index 4152017..93546de 100644
--- a/zless.in
+++ b/zless.in
@@ -53,5 +53,15 @@ if test "${LESSMETACHARS+set}" != set; then

-LESSOPEN="|gzip -cdfq -- %s"; export LESSOPEN
+less_version=`less -V` || exit
+case $less_version in
+'less 429
+'* | 'less '4[3-9][0-9]* | 'less '[5-9][0-9][0-9]* | 'less 
+   use_input_pipe_on_stdin='-';;
+*) use_input_pipe_on_stdin='';;
+LESSOPEN="|${use_input_pipe_on_stdin}gzip -cdfq -- %s"
+export LESSOPEN
 exec less "$@"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]