Package: less
Version: 321-2

(bcc-ed to [EMAIL PROTECTED])

On Mon, 17 Mar 1997, Park Chu Yeon wrote:

> When 'PAGER=zless', system will not work properly, which seems to be a
> bug of 'zless'.

why use zless for your PAGER when less can automatically de-compress files
before displaying them? 

try:

1.  set the environment variable LESSOPEN in your ~/.bashrc or in
    /etc/profile (modify as required if you use csh or zsh or something
    else).

        export LESSOPEN="|lesspipe.sh  %s"


2.  create a shell script called lesspipe.sh in /usr/local/bin.

        #!/bin/sh

        case "$1" in
            *.tar) tar tvf $1  2>/dev/null ;;
            *.tar.Z) tar tvfz $1  2>/dev/null ;;
            *.tar.gz) tar tvfz $1  2>/dev/null ;;
            *.Z) zcat $1  2>/dev/null ;;
            *.gz) zcat  -c $1  2>/dev/null ;;
            *.deb) dpkg -I $1 ; dpkg -c $1  2>/dev/null ;;
        esac

this can be extended to cover many more file types. 

Note that the order of the case statements is important...e.g. if you
don't have 'tar' before 'gz' then the gz line will "catch" .tar.gz files
and you wont get a listing.

This should be a standard part of the less package...so i'm submitting it as
a bug.

craig

Reply via email to