how to know if I'm using xterm or gnome-terminal?

Germán A. Racca german.racca at gmail.com
Tue Feb 23 20:38:06 UTC 2010


On Tue, 2010-02-23 at 20:23 +0000, James Wilkinson wrote: 
> Germán A. Racca wrote:
> > How to know if I'm using an xterm or a gnome-terminal from command line?
> > 
> > The output of "echo $TERM" is "xterm" from both of them.
> > 
> > How to know?
> 
> Well, it looks as though gnome-terminal sets $COLORTERM, whereas xterm
> doesn’t. But xterm doesn’t unset it, either, so if you get a user
> starting up a gnome-terminal, thinking “Yuck!”¹ and using that
> gnome-terminal solely to run xterm, then the xterm will inherit the
> $COLORTERM setting.
> 
> Xterm has its own $XTERM_ variables, so you could test for those. But
> gnome-terminal doesn’t unset those, either, so you could get a user
> starting up am xterm, thinking “Yuck!”¹ and using that xterm solely to
> run gnome-terminal…
> 
> And then you’re going to get someone using Konsole.
> 
> What are you trying to do?
> 
> James.
> 
> ¹There’s no accounting for taste…
> 
> -- 
> E-mail:     james@ | I must refute the rumour that one of our team members
> aprilcottage.co.uk | walks on water. Although it’s true that Barry Cryer runs
>                    | on lager...
>                    |     -- “I’m Sorry, I Haven’t A Clue”, BBC Radio 4

I'm running a program called IRAF to work with astronomical images, and
it needs to use the graphic capabilities of an xterm, not
gnome-terminal. So, I'm trying to make a very simple script to start
IRAF, but first I have to know if I'm on an xterm (so it enters directly
to IRAF) or a gnome-terminal (in this case the script must open an xterm
before).

Germán.

-- 
Germán A. Racca
National Institute for Space Research (INPE)
São José dos Campos - SP - Brasil
http://sites.google.com/site/gracca
http://gracca.wordpress.com



More information about the users mailing list