displayvar
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | displayvar [2008/02/12 13:53] (current) – created kleiner | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Conditionally setting the DISPLAY variable ====== | ||
+ | In OS X, if you want to use X11 programs from the Terminal, you have to set the environment variable DISPLAY as follows: | ||
+ | export DISPLAY=: | ||
+ | You can either put this line in your '' | ||
+ | On the other hand, if you only sporadically use '' | ||
+ | |||
+ | In the following we show a third, more elegant solution. It is a short script that detects whether X11 is running, and only then sets the variable. | ||
+ | |||
+ | Put the following code in your '' | ||
+ | < | ||
+ | PSOUT=`ps auxw | grep '/ | ||
+ | |||
+ | if [ -n " | ||
+ | # X11 is running | ||
+ | export DISPLAY=": | ||
+ | fi | ||
+ | </ | ||
+ | This code checks the list of running processes for an instance of '' |
displayvar.txt · Last modified: 2008/02/12 13:53 by kleiner