|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 . |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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! |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
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 amore elegant way of doing it. <sigh> Thank You. |
|
![]() |
| Outils de la discussion | |
|
|