On Wed, 5 Feb 2003, Nikhil Joshi wrote:
I'm trying to write a script in which a message is displayed by xmessage if X is running otherwise message is displayed by echo
I tried this :
if [ -f /tmp/.X0-lock ]
to test for the availability of X, look for the environment variable called DISPLAY:
if [ -n "$DISPLAY" ]; then xmessage message else echo message fi