Need to make "less" do a particular thing "right"

Paul Falstad pfalstad at phoenix.Princeton.EDU
Thu Feb 21 09:57:03 AEST 1991


phil at ux1.cso.uiuc.edu (Phil Howard KA9WGN) wrote:
>I want to make the "less" command NOT switch over to the alterate screen.
>I did RTFM and could not find this.

I hate this behavior too.  I don't think the FM tells how to get rid of
it; I checked the source and it looks like there's no option for it.
Here's the hack I use; works great for me.

---cut here---
#! /bin/sh
#
# a front end for less that does not make xterm swap screens
#
TERMCAP=`echo $TERMCAP | sed 's/:ti=[^:]*:te=[^:]*:/:ti=:te=:/'` \
   /usr/princeton/bin/less "$@"
---cut here---

This could be done more efficiently, obviously.  I have an environment
variable called LESSTERM that I set in my .zlogin that has the ti and
te entries removed; then I alias less to
'TERMCAP="$LESSTERM" /usr/local/bin/less'.  With a csh-like shell
you could do '(setenv TERMCAP LESSTERM; /usr/local/bin/less)'.
I don't just remove ti and te from TERMCAP because I want vi to
swap screens.

--
  Paul Falstad, pfalstad at phoenix.princeton.edu PLink:HYPNOS GEnie:P.FALSTAD
  I think there should be more race prejudice.  <slap> LESS race prejudice.
     Princeton University apologizes for the content of this article.



More information about the Comp.unix.questions mailing list