[Gllug] Detecting X in cshrc
Tethys
tet at accucard.com
Tue Apr 29 18:21:18 UTC 2003
Ian Norton writes:
>you could just see if the DISPLAY variable is defined?
No, no, no! I've lost count of the number of apps that do this,
and it's just plain wrong. The *only* way to see if you're in
X is to try connecting to the X server in $DISPLAY. It's quite
possible (and indeed in some cases, common) for it to be set,
but either not pointing to a valid X server, or pointing to
one that you don't have permissions to access.
xdpyinfo > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo "I'm running under X. Launch GUI app."
else
echo "I'm stuck on a console. Use the curses interface.
fi
But that doesn't seem to be what the original question was asking.
If you're in an xterm, then your $TERM is whatever you've either
set it to in your startup scripts, or inherited from the xterm
itself (usually just "xterm", but can be overriden with the -tn
command line switch).
What's the problem that you're trying to solve here? Why do you
want to override the default $TERM?
Tet
--
Gllug mailing list - Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug
More information about the GLLUG
mailing list