|
Home > Archive > Unix Shell > August 2007 > less -X
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| SiKing 2007-08-29, 1:20 pm |
| Hi all,
I need to access all of my back-room servers through ssh. Depending on where I
am starting from (Windows desktop, already logged into a server, etc.) I use a
variety of terminal emulators.
In some (but not all!) of these, the command less "misbehaves". I found that I
can fix it if I pass it -X. The description of less -X is:
Disables sending the termcap initialization and deinitialization strings to the
terminal. This is sometimes desirable if the deinitialization string does
something unnecessary, like clearing the screen.
My question is: how can I test from my .profile if need this or not?
TIA for any help.
| |
| Icarus Sparry 2007-08-29, 1:20 pm |
| On Wed, 29 Aug 2007 16:26:12 +0100, SiKing wrote:
> Hi all,
>
> I need to access all of my back-room servers through ssh. Depending on
> where I am starting from (Windows desktop, already logged into a server,
> etc.) I use a variety of terminal emulators.
> In some (but not all!) of these, the command less "misbehaves". I found
> that I can fix it if I pass it -X. The description of less -X is:
> Disables sending the termcap initialization and deinitialization strings
> to the terminal. This is sometimes desirable if the deinitialization
> string does something unnecessary, like clearing the screen. My question
> is: how can I test from my .profile if need this or not?
>
> TIA for any help.
There is no certain way of doing it.
The problem is that the terminal database on your servers (/etc/termcap, /
usr/share/terminfo) thinks that it can send certain command sequences to
your terminal emulator to make it do things, and your terminal emulator
doesn't do them.
The terminal database uses the TERM environment variable to decide which
entries to look up.
So essentially what you need to do is find out what the value of TERM is,
when you log in from various places, and either correct the value or else
set the LESS environment variable to include -X.
You might be able to do something like
export TERM LESS
switch "${SSH_CLIENT%% *}:$TERM" in
:*) ;; # Locally logged in
*:xterm) ;; # Leave xterm alone
192.168.1.1:ansi) TERM=vt100; LESS=-X ;; # Fix up this box
esac
in your profile, filling in the cases. The patterns match machine
addresses, then a colon, then the current value of TERM.
| |
| Bill Marcum 2007-08-29, 1:20 pm |
| On Wed, 29 Aug 2007 16:26:12 +0100, SiKing
<nospam@noway.invalid> wrote:
>
>
> Hi all,
>
> I need to access all of my back-room servers through ssh. Depending on
> where I am starting from (Windows desktop, already logged into a
> server, etc.) I use a variety of terminal emulators. In some (but not
> all!) of these, the command less "misbehaves". I found that I can fix
> it if I pass it -X. The description of less -X is: Disables sending
> the termcap initialization and deinitialization strings to the
> terminal. This is sometimes desirable if the deinitialization string
> does something unnecessary, like clearing the screen. My question is:
> how can I test from my .profile if need this or not?
>
> TIA for any help.
The proper solution would be to set TERM appropriately for whichever
emulator you are using. The command "tset" (not "test") might be
helpful. Or you could just always alias less="less -X".
--
Chaos is King and Magic is loose in the world.
| |
| SiKing 2007-08-30, 7:20 am |
| Bill Marcum wrote:
> On Wed, 29 Aug 2007 16:26:12 +0100, SiKing
> <nospam@noway.invalid> wrote:
>
> The proper solution would be to set TERM appropriately for whichever
> emulator you are using. The command "tset" (not "test") might be
> helpful. Or you could just always alias less="less -X".
Unfortunately, 'less -X' misbehaves on some other terminals. There are a few
that behave the same (correct) way with or without the -X ...
I will have a look at the tset.
Thanx!
| |
| SiKing 2007-08-30, 7:20 am |
| Icarus Sparry wrote:
> On Wed, 29 Aug 2007 16:26:12 +0100, SiKing wrote:
>
>
> There is no certain way of doing it.
>
> The problem is that the terminal database on your servers (/etc/termcap, /
> usr/share/terminfo) thinks that it can send certain command sequences to
> your terminal emulator to make it do things, and your terminal emulator
> doesn't do them.
>
> The terminal database uses the TERM environment variable to decide which
> entries to look up.
>
> So essentially what you need to do is find out what the value of TERM is,
> when you log in from various places, and either correct the value or else
> set the LESS environment variable to include -X.
>
> You might be able to do something like
>
> export TERM LESS
> switch "${SSH_CLIENT%% *}:$TERM" in
> :*) ;; # Locally logged in
> *:xterm) ;; # Leave xterm alone
> 192.168.1.1:ansi) TERM=vt100; LESS=-X ;; # Fix up this box
> esac
>
> in your profile, filling in the cases. The patterns match machine
> addresses, then a colon, then the current value of TERM.
I have considered a similar solution to what you propose, but I dismissed it as
too childish. I sent the original post here in hopes that there would be a
more elegant way of doing it. <sigh>
Thank You.
|
|
|
|
|