#!/bin/sh # Check if we can connect to Xserver cd /tmp verbose=false [ "$1" = -v ] && verbose=true && shift display=${1-$DISPLAY} [ "$display" = "" ] && echo no DISPLAY specified 1>&2 && exit 0 host=`echo $display | sed s/:.*//` port=600`echo $display | sed 's/.*:\([0-9]*\).*/\1/'` echo '' | socket -q $host $port > /dev/null 2>&1 zwerg=$? if [ $verbose = true ] ; then if [ $zwerg = 0 ] ; then echo X server $DISPLAY seems to exist. else echo X server $DISPLAY does not exist. fi fi exit $zwerg