Gentoo Archives: gentoo-dev

From: Morgan Christiansson <sft3905@××××××××××××.se>
To: gentoo-dev@××××××××××.org
Subject: Re: [gentoo-dev] Using less with compressed docs -- tip!
Date: Sat, 08 Sep 2001 17:01:04
Message-Id: 3B9AA313.5090001@post.netlink.se
In Reply to: [gentoo-dev] Using less with compressed docs -- tip! by Ben Beuchler
1 Redhat has a shell-script called /usr/bin/zless:
2
3 #!/bin/sh
4 /bin/zcat "$@" | /usr/bin/less
5
6 (zcat is hard-linked to gzip and gunzip)
7
8 /usr/bin/zmore also exists and is the same but has a much more
9 complicated shell script.
10
11 It sets some terminal options and stuff.
12
13 I attached some files there are a bunch more too.
14
15 These are the executables in redhats gzip package.
16
17 /bin/gunzip
18 /bin/gzip
19 /bin/zcat
20 /usr/bin/gunzip
21 /usr/bin/gzexe
22 /usr/bin/gzip
23 /usr/bin/zcmp
24 /usr/bin/zdiff
25 /usr/bin/zegrep
26 /usr/bin/zfgrep
27 /usr/bin/zforce
28 /usr/bin/zgrep
29 /usr/bin/zless
30 /usr/bin/zmore
31 /usr/bin/znew
32
33
34
35 Ben Beuchler wrote:
36
37 >Gentoo, by default, compresses any documetation installed by a program. Or so
38 >it appears, anyway. Viewing these files transparently is pretty easy. First,
39 >create a script like this:
40 >
41 >----------
42 >#!/bin/sh
43 >
44 >case "$1" in
45 > *.gz) gunzip -c $1 2>/dev/null
46 > ;;
47 >esac
48 >----------
49 >
50 >And put it somewhere easily accessible, like /usr/local/bin/lesspipe.sh.
51 >
52 >Now do this:
53 >
54 >export LESSOPEN="|/usr/local/bin/lesspipe.sh %s"
55 >
56 >You'll probably want to stick that in /etc/profile or something. Now if you
57 >try to use less top open a .gz file, it will work transparently.
58 >
59 >-Ben
60 >

Attachments

File name MIME type
zless text/plain
zmore text/plain
zgrep text/plain