Automatically setting the DISPLAY variable


Put one of the following in your ~/.profile and the DISPLAY variable will automatically be set to your client, no matter which client you're coming from, when you telnet in. Alternatively, you could put the command into /etc/profile and then it will work for all users on the system.

HP-UX:
export DISPLAY=`who -mT|awk '{ print $9}'`:0

Solaris:
export DISPLAY=`who -m|awk '{print $6}'|tr -d \( | tr -d \)`:0

07/24/2003