LESSOPEN starts with two vertical bars, the exit
status of the script becomes meaningful. If the exit status is zero, the output is considered to be replacement text, even if it is empty. If the exit status is nonzero, any output is ignored and the original file
is used. For compatibility with previous versions of less, if LESSOPEN starts with only one vertical bar, the exit status of the preprocessor is ignored.
When an input pipe is used, a LESSCLOSE postprocessor can be used, but it is usually not necessary since there is no replacement file to clean up. In this case, the replacement file name passed to the LESSCLOSE post‐
processor is "-".
For compatibility with previous versions of less, the input preprocessor or pipe is not used if less is viewing standard input. However, if the first character of LESSOPEN is a dash (-), the input preprocessor is
used on standard input as well as other files. In this case, the dash is not considered to be part of the preprocessor command. If standard input is being viewed, the input preprocessor is passed a file name con‐
sisting of a single dash. Similarly, if the first two characters of LESSOPEN are vertical bar and dash (|-) or two vertical bars and a dash (||-), the input pipe is used on standard input as well as other files.
Again, in this case the dash is not considered to be part of the input pipe command.
NATIONAL CHARACTER SETS
There are three types of characters in the input file:
normal characters
can be displayed directly to the screen.
control characters
should not be displayed directly, but are expected to be found in ordinary text files (such as backspace and tab).
binary characters
should not be displayed directly and are not expected to be found in text files.
A "character set" is simply a description of which characters are to be considered normal, control, and binary. The LESSCHARSET environment variable may be used to select a character set. Possible values for LESS‐
CHARSET are:
ascii BS, TAB, NL, CR, and formfeed are control characters, all chars with values between 32 and 126 are normal, and all others are binary.
iso8859
Selects an ISO 8859 character set. This is the same as ASCII, except characters between 160 and 255 are treated as normal characters.
latin1 Same as iso8859.
latin9 Same as iso8859.
dos Selects a character set appropriate for MS‐DOS.
ebcdic Selects an EBCDIC character set.
IBM‐1047
Selects an EBCDIC character set used by OS/390 Unix Services. This is the EBCDIC analogue of latin1. You get similar results by setting either LESSCHARSET=IBM‐1047 or LC_CTYPE=en_US in your environment.
koi8‐r Selects a Russian character set.
next Selects a character set appropriate for NeXT computers.
utf‐8 Selects the UTF‐8 encoding of the ISO 10646 character set. UTF‐8 is special in that it supports multi‐byte characters in the input file. It is the only character set that supports multi‐byte characters.
windows
Selects a character set appropriate for Microsoft Windows (cp 1251).
In rare cases, it may be desired to tailor less to use a character set other than the ones definable by LESSCHARSET. In this case, the environment variable LESSCHARDEF can be used to define a character set. It
should be set to a string where each character in the string represents one character in the character set. The character "." is used for a normal character, "c" for control, and "b" for binary. A decimal number may
be used for repetition. For example, "bccc4b." would mean character 0 is binary, 1, 2 and 3 are control, 4, 5, 6 and 7 are binary, and 8 is normal. All characters after the last are taken to be the same as the last,
so characters