Allow the TERM env variable to be overwritten by .ssh/config
Iain Morgan
imorgan at nas.nasa.gov
Wed Sep 24 04:01:02 EST 2014
On Mon, Sep 22, 2014 at 20:35:06 -0700, Palmer Dabbelt wrote:
> On Mon, 22 Sep 2014 19:06:51 PDT (-0700), imorgan at nas.nasa.gov wrote:
> > On Mon, Sep 22, 2014 at 15:33:29 -0700, Palmer Dabbelt wrote:
> > > This is pretty much the same request as an old mailing list thread
> > >
> > > http://marc.info/?l=openssh-unix-dev&m=134073696320230&w=2
> > >
> > > for almost exactly the same reason: some machines don't have
> > > new-enough terminal info databases to support newer TERM strings
> > > ("rxvt-unicode-256color" in my case). As such, I'd like to be able to
> > > override the TERM that is forwarded to some machines from my
> > > .ssh/config.
> > >
> > > The solutions proposed in that post don't work well for me because I
> > > like having a shared .bashrc and don't want to go making it super long
> > > just to have a big list of hosts that don't support "*-256color".
> > >
> >
> > Perhaps you could use tput to test for terminal capabilities rather than
> > keeping a list of hosts.
> >
> > I've had to deal with a somewhat different issue; preferring to suppress
> > color support. I used to use "tput colors" to test for the number of
> > colors supported, and re-define TERM as needed. More recently, I taken
> > to simply overriding the terminfo definitions for those terminal types
> > that I use by creating a ~/.terminfo directory or ~/.terminfo.db
> > database.
>
> These are all hosts that are managed by the university, so I've got to
> have some username overrides in there anyway. This way just seemed
> like the path of least resistance.
>
> Just doing a "tput colors" doesn't seem to do it for me:
>
> $ tput colors
> tput: unknown terminal "rxvt-unicode-256color"
>
> I could just check for a "tput" failure and redefine the terminal, I
> don't really like overriding TERM because I worry about how it'll
> interact with screen and such.
>
> I think overriding the terminfo database is probably the best way to
> do this, I didn't know that was possible! Unfortunately it doesn't
> appear to work on OSX, but that might just be user error...
OS X may need a ~/.terminfo.db file rather than a ~/.terminfo directory.
On Linux (RHEL and SLES) ~/.terminfo works, whereas on OpenBSD you need
~/.terminfo.db. I haven't experimented with OS X.
--
Iain Morgan
More information about the openssh-unix-dev
mailing list