Gentoo Archives: gentoo-user

From: Nick Rout <nick@×××××××.nz>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Can a script tell if it's running under X?
Date: Sat, 04 Dec 2004 21:42:04
Message-Id: 1102196585.10364.6.camel@sf.rout.dyndns.org
In Reply to: [gentoo-user] Can a script tell if it's running under X? by Kevin O'Gorman
1 One way is test if $DISPLAY is set, if it is then you are running in X
2
3 On Sat, 2004-12-04 at 13:34 -0800, Kevin O'Gorman wrote:
4 > Is there a way for a script (bash, for instance) to know
5 > if it's running under X, such as in an xterm or konsole?
6 >
7 > I want to have scripts that run graphical tools if the
8 > infrastructure is present, and text tools otherwise.
9 > For me this is particularly useful for tools I don't use
10 > all that often, and can forget that a graphical version
11 > exists.
12 >
13 > ++ kevin
14 >
15 --
16 Nick Rout <nick@×××××××.nz>
17
18
19 --
20 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] Can a script tell if it's running under X? cdemarco@××××××××.fm