LESSPIPE.SH(1) User Commands LESSPIPE.SH(1)
NAME
lesspipe.sh - a filter for less
SYNOPSIS
lesspipe.sh [FILE[s]]...
DESCRIPTION
Usually lesspipe.sh is called as an input filter to less With the help of that filter less will display the uncompressed contents of com- pressed (gzip, bzip2, compress, rar, 7-zip, lzip or lzma) files. For files containing archives and directories, a table of contents will be displayed (e.g tar, ar rar, jar, rpm and deb formats). Other supported formats include nroff, pdf, ps, dvi, shared library, MS word, Openof- fice, debian package, html, mp3, jpg, png, iso images, MacOSX bom, plist and archive formats, perl storable data and gpg encrypted files. This does require additional helper programs being installed. The filter does not only display the above mentioned file formats, but can also be applied recursively up to a depth of 6 where applying a decompression algorithm counts as a separate level. In a few rare cases the file command does not recognize the correct format (especially with nroff). In such cases filtering can be sup- pressed by a trailing colon on the file name. Some converting between UTF-8, ISO-8859-1 and UTF-16 character encod- ings is done. If text in the "wrong" encoding is detected then the text is transformed into the native encoding used by the system. This does make assumptions concerning the encodings and may not in all cases improve the display
FILTER ACTIVATION
The filter is called from less provided the environment variable LESSOPEN is set properly. For the shells csh and tcsh the command setenv LESSOPEN "|lesspipe.sh %s" should be used, for other shells the command LESSOPEN="|lesspipe.sh %s"; export LESSOPEN does activate the filter for less. Use the fully qualified path, if lesspipe.sh is not in the search path. The command to set LESSOPEN can also be displayed by calling lesspipe.sh without arguments. This can even be used to set LESSOPEN directly: eval `lesspipe.sh` Having set the environment variable as described above, less will then display textual information for a wide range of file formats.
ADVANCED USAGE
This version of lesspipe.sh allows you to view individual files con- tained in a file archive, which itself may even be contained in another archive. The notation for viewing files in multifile archives is less archive_file:contained_file or even less super_archive:archive_file:contained_file To display a file in raw format, a colon (:) has to be appended to the file name. To suppress the decompression of files two colons have to be appended. This does apply as well to the last file in the colon sep- arated chain of file names as described above. To display files without engaging lesspipe.sh temporarily, the command cat filename | less can be used instead of unsetting the environment variable LESSOPEN
SYNTAX HIGHLIGHTING (experimental)
The filter is able to do syntax highlighting for the languages ada, asm, awk, c, c++, groff, html, xml, java, javascript, lisp, m4, make, pascal, patch, perl, povray, python, ruby shellscript and sql. The choice of colors is just a first guess (proof of concept) and still needs refinements. ATTENTION: Syntax highlighting is only activated, if the environment variable LESS exists and contains the option -R or -r or less is called with one of these options. This guarantees, that instead of literal escape sequences, colors are displayed. The detection of the -r/-R presence at runtime is rather dependent on the operating system and may not work in all cases. Putting the option in the LESS environment variable is guaranteed to work. As syntax highlighting is rather resource intense, it can be switched off by appending a colon after the file name, if the output was color- ful. If the wrong language was chosen for syntax highlighting, then another one can be forced by appending a colon and a suffix to the file name. The following suffixes are recognized: .ada .asm .inc .awk .c .h .cpp .cxx .groff .html .php .xml .java .js .lsp .m4 Makefile .pas .patch .diff .pm .pl .pod .pov .py .rb .sh .sql
AUTHOR
Written by Wolfgang Friebel
REPORTING BUGS
Report bugs to <Wolfgang.Friebel AT desy.de>.
COPYRIGHT
Copyright (C) 2005-2008 Wolfgang Friebel This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
SEE ALSO
less(1) A description of lesspipe.sh is also contained in the file README con- tained in the source code package lesspipe.sh Aug 2008 LESSPIPE.SH(1)
lesspipe 1.60 - Generated Fri Dec 5 19:35:29 CST 2008