Penguin
Annotated edit history of lesspipe(1) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 LESSOPEN
2 !!!LESSOPEN
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 USAGE
7 USER DEFINED FILTERS
8 FILES
9 BUGS
10 SEE ALSO
11 AUTHOR
12 ----
13 !!NAME
14
15
16 lessfile, lesspipe -
17 !!SYNOPSIS
18
19
20 __lessfile, lesspipe__
21 !!DESCRIPTION
22
23
24 This manual page documents briefly the ''lessfile'', and
25 ''lesspipe'' commands. This manual page was written for
26 the Debian GNU/Linux distribution because the input
27 preprocessor scripts are provided by Debian GNU/Linux and
28 are not part of the original program.
29
30
31 ''lessfile'' and ''lesspipe'' are programs that can be
32 used to modify the way the contents of a file are displayed
33 in ''less.'' What this means is that ''less'' can
34 automatically open up tar files, uncompress gzipped files,
35 and even display something reasonable for graphics
36 files.
37
38
39 ''lesspipe'' will toss the contents/info on STDOUT and
40 ''less'' will read them as they come across. This means
41 that you do not have to wait for the decoding to finish
42 before less shows you the file. This also means that you
43 will get a 'byte N' instead of an N% as your file position.
44 You can seek to the end and back to get the N% but that
45 means you have to wait for the pipe to finish.
46
47
48 ''lessfile'' will toss the contents/info on a file which
49 ''less'' will then read. After you are done,
50 ''lessfile'' will then delete the file. This means that
51 the process has to finish before you see it, but you get
52 nice percentages (N%) up front.
53 !!USAGE
54
55
56 Just put one of the following two commands in your login
57 script (e.g. ~/.bash_profile):
58
59
60 ''eval $(lessfile)'' or ''eval
61 $(lesspipe)''
62 !!USER DEFINED FILTERS
63
64
65 It is possible to extend and overwrite the default
66 ''lesspipe'' and ''lessfile'' input processor if you
67 have specialized requirements. Create an executable program
68 with the name ''.lessfilter'' and put it into your home
69 directory. This can be a shell script or a binary
70 program.
71
72
73 It is important that this program returns the correct exit
74 code: return 0 if your filter handles the input, return 1 if
75 the standard ''lesspipe/lessfile'' filter should handle
76 the input.
77
78
79 Here is an example script:
80
81
82 #!/bin/sh
83
84
85 case
86
87
88 # No further processing by lesspipe necessary exit
89 0
90 !!FILES
91
92
93 ''~/.lessfilter''
94
95
96 Executable file that can do user defined processing. See
97 section USER DEFINED FILTERS for more
98 information.
99 !!BUGS
100
101
102 When trying to open compressed 0 byte files, ''less''
103 displays the actual binary file contents. This is not a bug.
104 ''less'' is designed to do that (see manual page less(1),
105 section INPUT PREPROCESSOR). This is the answer of Mark
106 Nudelman ''
107
108
109
110
111 Sometimes, less does not display the contents file you want
112 to view but output that is produced by your login scripts
113 (~/.bashrc or ~/.bash_profile). This happens because less
114 uses your current shell to run the lesspipe filter. Bash
115 first looks for the variable $BASH_ENV in the environment
116 expands its value and uses the expanded value as the name of
117 a file to read and execute. If this file produces any output
118 less will display this. A way to solve this problem is to
119 put the following lines on the top of your login script that
120 produces output:
121
122
123 if [[ -z
124
125
126 This tests whether the prompt variable $PS1 is set and if it
127 isn't (which is the case for non-interactive shells) it will
128 exit the script.
129 !!SEE ALSO
130
131
132 less(1)
133 !!AUTHOR
134
135
136 This manual page was written by Thomas Schoepf
137 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.