"less" annoyance, filters html source

der.hans plug-discuss@lists.plug.phoenix.az.us
Wed, 4 Dec 2002 13:50:36 -0700 (MST)


Am 04. Dec, 2002 schw=E4tzte William Lindley so:

> The "less" program that comes with Mandrake 9 how attempts to "render"
> html files instead of showing the source.  It says you can append ':' to
> the filename to suppress the filter -- which works -- but does anyone hav=
e
> a clue how to override it permanently?  The 'info' and 'man' pages don't
> give a hint.

In /usr/share/doc/less/LESSOPEN I find:

----
From=20the man page:
       You  may  define an "input preprocessor" for less.  Before
       less opens a file, it first gives your input  preprocessor
       a  chance  to  modify the way the contents of the file are
       displayed.

What this means is that less(1) can automatically open up tar files,
uncompress gzipped files, and even display something reasonable for
graphics files.

You just need to put the following in your
=2Ezlogin/.login/.bash_profile/whatever:

eval $(lesspipe)
or
eval $(lessfile)

lesspipe will toss the contents/info on stdout and less will read them
as they come across.  This means that you don't have to wait for the
decoding to finish before less shows you the file.  This also means that
you'll get a 'byte N' instead of an N% as your file position.  You can
seek to the end and back to get the N% but that means you have to wait
for the pipe to finish.

=2E
=2E
=2E
----

I haven't allowed this for any of my boxen.

$ file /usr/bin/lesspipe
/usr/bin/lesspipe: Bourne shell script text executable

I'd say look for that. Change it to not muck w/ html files.

ciao,

der.hans
--=20
#  https://www.LuftHans.com/    http://www.TOLISGroup.com/
#  A t-shirt a day keeps the noose (tie) away. - der.hans