PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > less -X
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

less -X

Réponse
 
LinkBack Outils de la discussion
Vieux 29/08/2007, 16h26   #1
SiKing
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut less -X

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 .
  Réponse avec citation
Vieux 29/08/2007, 18h02   #2
Bill Marcum
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: less -X

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 .


The proper solution would be to set TERM appropriately for whichever
emulator you are using. The command "tset" (not "test") might be
ful. Or you could just always alias less="less -X".


--
Chaos is King and Magic is loose in the world.
  Réponse avec citation
Vieux 29/08/2007, 18h03   #3
Icarus Sparry
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: less -X

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 .


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.
  Réponse avec citation
Vieux 30/08/2007, 08h35   #4
SiKing
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: less -X

Bill Marcum wrote:
> 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 .

>
> The proper solution would be to set TERM appropriately for whichever
> emulator you are using. The command "tset" (not "test") might be
> ful. 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!
  Réponse avec citation
Vieux 30/08/2007, 08h38   #5
SiKing
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: less -X

Icarus Sparry wrote:
> 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 .

>
> 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.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h38.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,13585 seconds with 13 queries