INSTALL ======= Execute the following commands (for a more detailed description see below): ./configure cp lesspipe.sh sxw2txt code2color /usr/local/bin or if you prefer make: make make test make install Then do set the environment variable LESSOPEN: LESSOPEN="|/usr/local/bin/lesspipe.sh %s"; export LESSOPEN #(sh like shells) setenv LESSOPEN "|/usr/local/bin/lesspipe.sh %s" #(csh, tcsh) DO NOT OMIT THE VERTICAL BAR AS FIRST CHARACTER, IT IS ESSENTIAL !!! Detailed description ==================== Prerequisites: -------------- For a detailed discussion consult the file README starting with the section 'Required programs'. For best results up to date versions of 'file' (4.17 or later), tar, gzip, bzip2 and the programs antiword, html2text and o3read are highly recommended. Step 1: recreate lesspipe.sh and Makefile (optional) ---------------------------------------------------- To verify a working system and to customize lesspipe.sh to your needs recreate lesspipe.sh from lesspipe.sh.in (and Makefile) by the command ./configure [--help] [--ask|--default|--yes] [--prefix=] [--shell=] For an explanation of the options do execute ./configure --help To create a lesspipe.sh assuming all helper applications are in place do execute ./configure --yes To accept the defaults searching the helper apps in $PATH please use ./configure --default To create a Makefile that does ask questions by default do use ./configure --ask To install lesspipe.sh and code2color in /bin (with make install) use ./configure --prefix= To create lesspipe.sh for a specific shell ((k)sh like shells only) do say ./configure --shell= The recreation of lesspipe.sh can also be achieved by using the supplied or regenerated Makefile with the command make [MODE=ask|default|yes] [PREFIX=] where the optional parameters MODE and PREFIX correspond to the configure options described above. Forcing the use of a specific shell is not possible. ## Please note that the activation of syntax highlighting does slow down ## the display of files noticeably. I do therefore recommend not using it. ## You can watch the difference when running the test suite (make test) ## with and without syntax highlighting. Step 2: verify that lesspipe.sh is working correctly (optional) --------------------------------------------------------------- A test suite has been added that does cover complicated use cases of less where bugs have been fixed recently. Attempts are made to add normal use cases as well. If the test suite reports "NOT ok" lines then lesspipe.sh is probably not fully functional in your environment. To execute the test suite the command make test or ./test.pl [-d] can be used. The option -d is for debugging. In case of errors please read the file testok/README. Step 3: install lesspipe.sh, code2color and sxw2txt --------------------------------------------------- You can copy lesspipe.sh to any appropriate place. Suggested location: /usr/local/bin/lesspipe.sh For syntax highlighting to work you have to copy the perl script code2color to the same directory. The program sxw2txt is required for decoding Openoffice and OpenDocument (OASIS) documents, if o3read is not installed. cp lesspipe.sh code2color sxw2txt /usr/local/bin This can be achieved also with make: make install [PREFIX=] copies the scripts to /bin in addition for MacOS X users only: If you want to take advantage of handling package directories (.pkg) and bill of material files (.bom) you may have to edit the magic file for file type recognition. It usually resides in /etc/magic or /usr/share/magic. You have to add to that file a line 0 string BOMStore Mac OS X bill of materials (BOM) file Step 4: activate lesspipe.sh ---------------------------- To make use of the installed lesspipe.sh set the environment variable LESSOPEN: I recommend to use the fully qualified path to avoid problems with other scripts of the same name or with a changed search PATH: LESSOPEN="|/usr/local/bin/lesspipe.sh %s"; export LESSOPEN #(sh like shells) setenv LESSOPEN "|/usr/local/bin/lesspipe.sh %s" #(csh, tcsh) If syntax highlighting is activated in the script then to actually see highlighted or colored code less has to be called with option -r or -R! Generated lesspipe.sh and Makefile in the package ================================================= the supplied files were generated on a SuSE 9.2 Linux system with ./configure --ask and answering all questions except the one for syntax highlighting with y.