Re: x11-users digest, Vol 1 #65 - 18 msgs
Re: x11-users digest, Vol 1 #65 - 18 msgs
- Subject: Re: x11-users digest, Vol 1 #65 - 18 msgs
- From: Yves Pouplard <email@hidden>
- Date: Wed, 22 Jan 2003 01:46:18 +0100
On Tue, 21 Jan 2003 14:15:48 -0800, Michael wrote:
> if you are using bash, it looks kinda like this:
> if [ ! $?DISPLAY ] ; then
> DISPLAY=":0.0"
> fi
or:
if [ ${#DISPLAY} -eq 0 ]; then
export DISPLAY=':0.0'
fi
which can also be shortened this way:
[[ ${#DISPLAY} -eq 0 ]] && export DISPLAY=':0.0'
(don't forget the "export") => ${#varname} means the length of the
value stored inside the variable, which is zero when the variable is
empty or undefined :-)
so a better way could be:
[[ ${#DISPLAY} -lt 4 ]] && export DISPLAY=':0.0'
as any value shorter than 4 characters (ex: DISPLAY='xxx') could be
incomprehensible for X11 :-)
--
Yves Pouplard
email@hidden
_______________________________________________
x11-users mailing list | email@hidden
Help/Unsubscribe: http://www.lists.apple.com/mailman/listinfo/x11-users
Do not post admin requests to the list. They will be ignored.