Gentoo Archives: gentoo-user

From: Matan Peled <chaosite@×××××.com>
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:45:38
Message-Id: 41B22FE8.2070107@gmail.com
In Reply to: [gentoo-user] Can a script tell if it's running under X? by Kevin O'Gorman
1 Kevin O'Gorman wrote:
2
3 >Is there a way for a script (bash, for instance) to know
4 >if it's running under X, such as in an xterm or konsole?
5 >
6 >I want to have scripts that run graphical tools if the
7 >infrastructure is present, and text tools otherwise.
8 >For me this is particularly useful for tools I don't use
9 >all that often, and can forget that a graphical version
10 >exists.
11 >
12 >++ kevin
13 >
14 >
15 >
16 Another way would be to check ${TERM} - on a tty, its "linux", and in X
17 it specifies the terminal emulator (rxvt, xterm, Eterm, etc.).

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] Can a script tell if it's running under X? Bastian Balthazar Bux <BastianBalthazarBux@×××××××××.it>