[SunHELP] $DISPLAY for root

David Baldwin sunhelp at sunhelp.org
Fri Aug 17 10:31:31 CDT 2001


AHA!!!
I should have seen that
But, alas, the error still occurs.
I am using bash for users and sh for root if it makes any difference.  I
did try it as a regular user also.
DAve

-----Original Message-----
From: Will Mc Donald [mailto:wmcdonald at orctel.co.uk]=20
Sent: Friday, August 17, 2001 3:19 PM
To: sunhelp at sunhelp.org
Subject: Re: [SunHELP] $DISPLAY for root

Looks like it needs a finishing fi...

# Set the DISPLAY global environment variable.
if [ ! "$DISPLAY" ]; then
       set -A DISPLAY $(who -um)
       DISPLAY=3D${DISPLAY[$((${#DISPLAY[*]} - 1))]}
       DISPLAY=3D${DISPLAY%:0.0}:0.0
       export DISPLAY
fi

... tested with bash and ksh.

----- Original Message -----=20
From: "David Baldwin" <dbaldwin at networkinsight.com>
To: <sunhelp at sunhelp.org>
Sent: Friday, August 17, 2001 3:09 PM
Subject: RE: [SunHELP] $DISPLAY for root


> I threw that snip in my /etc/profile but when I ". /etc/profile" I get
a
> syntax error.  ( is unexpected.  I checked that they all match up
> properly but I can't find where the problem is.  I am working on my
> shell scripting but I am by no means good at it.  Is there something
> else that needs to happen first?
>=20
> Thanks for all the help
> Dave Baldwin
>=20
>=20
>=20
> -----Original Message-----
> From: David Ledger [mailto:dledger at ivdcs.demon.co.uk]=20
> Sent: Thursday, August 16, 2001 6:56 AM
> To: sunhelp at sunhelp.org
> Subject: RE: [SunHELP] $DISPLAY for root
>=20
> >
> >  > >Hi,
> >>  >When I "su -" to any user the display is not set.
> >>  >I can't remember if this was happening always but I
> >>  started noticing it
> >>  >after installing ssh and enabling X11 forwarding.
> >>  >Note: this happens even when ssh is not in use.
> >>  >Thanks for any help or suggestions, always
> >>  appreciated.
> >>  >
> >  > >Dave Baldwin
>=20
> # Set the DISPLAY global environment variable.
> if [ ! "$DISPLAY" ]; then
>        set -A DISPLAY $(who -um)
>        DISPLAY=3D${DISPLAY[$((${#DISPLAY[*]} - 1))]}
>        DISPLAY=3D${DISPLAY%:0.0}:0.0
>        export DISPLAY
>=20
> should do it.  My .profile calls a script that does the above first,=20
> and if that fails to give an answer it looks up the process tree to=20
> find the xterm process.  My xterm starter scripts always use the=20
> -display as the first parameter so it appears in a ps list for that=20
> reason.
>=20
> David.
>=20
> --=20

_______________________________________________
SunHELP maillist  -  SunHELP at sunhelp.org
http://www.sunhelp.org/mailman/listinfo/sunhelp



More information about the SunHELP mailing list