X11 capturing DISPLAY value

wynfield@gmail.com wynfield@gmail.com
Sun Mar 10 23:17:00 GMT 2013

I wanted to capture the X11 DISPLAY value that shows on the console when 'startx &' in invoked and successful.  I've tried:

 startx 2>&1 | grep DISPLAY\= >/tmp/xwin.txt &
 startx 2>&1 | grep DISPLAY >/tmp/xwin.txt &

but neither worked.  I could check files in /tmp/.X11-unix/* for date, owner, etc, and hope that the newest one is the right one and extract the number from the name, however if another user started an X window in the meantime I'd get the wrong DISPLAY v

Is there a preferred standard way to get this value?

Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

More information about the Cygwin mailing list