How can I set up my .bashrc such that the value of an environment variable changes based on whether or not the current session has access to the gui / windowing system?
For example, let's say I have an environment variable that controls which diff program my VCS will use.
When I'm sitting at the machine, I'd like to use a GUI program. However, when I connect remotely via SSH, I'd like to have it automatically use a text-based terminal diff viewer instead.
How can I check whether or not the windowing system is available?