On Thu, Jul 28, 2005 at 10:55:03AM -0400, [EMAIL PROTECTED] wrote:
> How can I tell if I'm running under X in a shell script? If I'm in X, I
> want to start screen: screen -m -c /my/config/file. If I'm not under X,
> I want to start without the -m. It's an odd google to find the answer to
> this question, so your wisdom is appreicated.
[...]
Assuming a Bourne-like shell:
if [ -n "${DISPLAY++}" ]; then
exec screen -m -c /my/config/file
fi
You may additionaly want to check whether you can connect to
that X server:
if xdpyinfo > /dev/null 2>&1; then
exec screen -m -c /my/config/file
fi
If by "under X" you mean, is the current pseudo terminal
controlled by a X terminal emulator, you can try:
if xwininfo -id "$WINDOWID" > /dev/null 2>&1; then
exec screen -m -c /my/config/file
fi
--
Stephane
_______________________________________________
screen-users mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/screen-users