Gentoo Archives: gentoo-user

From: Bastian Balthazar Bux <BastianBalthazarBux@×××××××××.it>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Can a script tell if it's running under X?
Date: Sun, 05 Dec 2004 00:42:19
Message-Id: 41B25C8F.90702@pnpitalia.it
In Reply to: Re: [gentoo-user] Can a script tell if it's running under X? by Matan Peled
1 Matan Peled wrote:
2
3 > Kevin O'Gorman wrote:
4 >
5 >> Is there a way for a script (bash, for instance) to know
6 >> if it's running under X, such as in an xterm or konsole?
7 >>
8 >> I want to have scripts that run graphical tools if the
9 >> infrastructure is present, and text tools otherwise.
10 >> For me this is particularly useful for tools I don't use
11 >> all that often, and can forget that a graphical version
12 >> exists.
13 >>
14 >> ++ kevin
15 >>
16 >>
17 >>
18 > Another way would be to check ${TERM} - on a tty, its "linux", and in
19 > X it specifies the terminal emulator (rxvt, xterm, Eterm, etc.).
20
21 dangerous, if you login via telnet or ssh it's a choiche of the client
22 and thae coise is pretty large
23
24 --
25 gentoo-user@g.o mailing list